40esp Posted June 8, 2008 Share Posted June 8, 2008 Im using this script to upload an image and resize it to a thumbnail: <?php if(isset($_POST['submit'])) { $path_thumbs = "../images/attorney_photos/"; $img_thumb_width = 100; $extlimit = "yes"; $limitedext = array(".gif",".jpg",".png",".jpeg",".bmp"); $file_type = $_FILES['add_photo']['type']; $file_name = $_FILES['add_photo']['name']; $file_size = $_FILES['add_photo']['size']; $file_tmp = $_FILES['add_photo']['tmp_name']; if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload!. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); } $ext = strrchr($file_name,'.'); $ext = strtolower($ext); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "That File Extension Type is Not Supported, Please Convert the File to a JPEG, PNG, GIF, or BMP File."; exit(); } $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; $rand_name = md5(time()); $rand_name= rand(0,999999999); $ThumbWidth = $img_thumb_width; if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } list($width, $height) = getimagesize($file_tmp); $newwidth = 103; $newheight = 131; if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($resized_img,"$path_thumbs/$rand_name.$file_ext"); imagedestroy($resized_img); imagedestroy($new_img); } move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext"); $msg = "$rand_name.$file_ext"; header("Location: attorney_resize.php?msg=$msg"); exit();} ?> The problem is, I cannot upload more than 1 megabyte of data.... Why is that? Link to comment https://forums.phpfreaks.com/topic/109303-solved-cannot-upload-past-1meg/ Share on other sites More sharing options...
Minase Posted June 8, 2008 Share Posted June 8, 2008 cause PHP is restricting you,try to make php size limit larger Link to comment https://forums.phpfreaks.com/topic/109303-solved-cannot-upload-past-1meg/#findComment-560674 Share on other sites More sharing options...
webent Posted June 8, 2008 Share Posted June 8, 2008 yep, on your php.ini file Link to comment https://forums.phpfreaks.com/topic/109303-solved-cannot-upload-past-1meg/#findComment-560677 Share on other sites More sharing options...
40esp Posted June 8, 2008 Author Share Posted June 8, 2008 I had a feeling about that. Thanks! now I know whats wrong. I'll change the value on my server. Link to comment https://forums.phpfreaks.com/topic/109303-solved-cannot-upload-past-1meg/#findComment-560682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.