Boo-urns Posted January 28, 2007 Share Posted January 28, 2007 My script is working great for files under 2mb, anything above it doesn't want to upload and is saying the filesize is 0.Form information is this: [code]<form action="changePictureParse.php" method="post" enctype="multipart/form-data"><input type="file" name="imagefile"><br /><input type="submit" name="submit" value="Upload Photo">[/code][code]//db info$ok = 1;$filesize = $_FILES['imagefile']['size'];echo $filesize;$maxSize = 2097200;if ($filesize > $maxSize){ echo "Your file is too large.<br>"; $ok=0; } if($ok == 1) { //then the rest of uploading the image[/code] Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/ Share on other sites More sharing options...
matto Posted January 28, 2007 Share Posted January 28, 2007 when you say "filesize is 0" where are you getting this information from - the server ? Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171086 Share on other sites More sharing options...
gerkintrigg Posted January 28, 2007 Share Posted January 28, 2007 i think you might be echoing the $ok variable, because you've set the $maxSize to little over 2Meg... Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171090 Share on other sites More sharing options...
Boo-urns Posted January 28, 2007 Author Share Posted January 28, 2007 Hmmm yea I'll see about the filesize echoing however my script says it is. Yea I'm getting the information from the server when i activate the script. The only part that confuses me is if its under 2mb then it will show the filesize when i echo it. Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171238 Share on other sites More sharing options...
Boo-urns Posted January 28, 2007 Author Share Posted January 28, 2007 Here is what i got when i uploaded a 1.9 MB file the echo is: 1996496Here is what i got when i tried a 2.9 MB file: 0Warning: Division by zero in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 31Warning: imagecreatetruecolor(): Invalid image dimensions in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 32Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 36Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 40Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 45Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/burns/public_html/guru/MyPetwork/changePictureParse.php on line 46 Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171353 Share on other sites More sharing options...
matto Posted January 28, 2007 Share Posted January 28, 2007 Do you now have a file on the server that has a zero length (0 bytes)?Something to consider: Have you exceeded your hosting disk quota ? Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171434 Share on other sites More sharing options...
Boo-urns Posted January 28, 2007 Author Share Posted January 28, 2007 Yea that is a good question about the disk quota it does say i'm at 91.8 % full so we'll try taking some files off of there. Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171437 Share on other sites More sharing options...
matto Posted January 28, 2007 Share Posted January 28, 2007 Any files you attempt to upload that are going to exceed your quota will end up with a zero length ;) Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171438 Share on other sites More sharing options...
ShogunWarrior Posted January 28, 2007 Share Posted January 28, 2007 The real problem is probably that the normal Apache/PHP upload file size is capped at 2MB so you will need to edit HTTPD.CONF to allow file sizes greater than that. Quote Link to comment https://forums.phpfreaks.com/topic/36047-upload-file-size-error/#findComment-171440 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.