Jump to content

[SOLVED] Cannot upload past 1meg


40esp

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.