play_ Posted December 17, 2007 Share Posted December 17, 2007 Here's the code: <form action="#" method="post" enctype="multipart/form-data"> <input type="file" name="upfile" /> <input type="submit" name="submit" /> </form> <?php if(isset($_POST['submit'])) { echo "<pre>"; print_r($_FILES); echo "</pre>"; } ?> PHP.INI has upload size limit of 2M. Ok, If i upload small files, like images, texts, etc. it works. as expected. Now i upload an image of ~3M. Array ( [upfile] => Array ( [name] => untitled.bmp [type] => [tmp_name] => [error] => 1 [size] => 0 ) ) gave me an error of 1, which according to the manual, "Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini." Ok. that works as expected. then i go on and try uploading a video file. tried ones of 20M and over. Nothing happens. No errors. Array doesn't print out. Just blank. Any thoughts? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 17, 2007 Share Posted December 17, 2007 Perhaps it times out? A timeout could occur either on the server or on your browser. Or there could be underlying network instability that means that long-running transfers like that tend to be broken part-way through. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 17, 2007 Share Posted December 17, 2007 I believe apache has a upload limit also, not much you can do here unless you develop a system to stream a file off the hard drive to your server and php lacks that support. Good test is use javascript and verify a valid extension on it, helps a bit Quote Link to comment Share on other sites More sharing options...
play_ Posted December 17, 2007 Author Share Posted December 17, 2007 I am using javascript thus far. But what if the user turns javascript off? I am using this: http://www.fyneworks.com/jquery/multiple-file-upload/ So, on the server side, i also validate each file, with a for loop. But if one file is too big, the entire $_FILES array shows up as blank. Not just the really big file array (ie $_FILES['bigfile']). So i can't even report an error back saying "file $_FILES['upload']['movie.avi'] is too big to be uploaded'. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2007 Share Posted December 17, 2007 A non-existent $_FILES array means you have exceed the post_max_size setting. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 17, 2007 Share Posted December 17, 2007 A non-existent $_FILES array means you have exceed the post_max_size setting. Not technically as it could be you uploaded 0 files, the array always populates I believe if multi type post is sent. But you can simply add to your error checking if(empty($_FILES['File'.$n]) die Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2007 Share Posted December 17, 2007 If no file is uploaded the $_FILES array has an entry and the ['error'] element has a value of 4. Like I said, if the total upload size exceeds the the max post size, the $_FILES array is empty. Quote Link to comment Share on other sites More sharing options...
play_ Posted December 18, 2007 Author Share Posted December 18, 2007 PFMaBiSmAd: Not true. Upload limit is 2M. i uploaded a 3.5mb file and it worked. cooldude: Not technically as it could be you uploaded 0 files, the array always populates I believe if multi type post is sent. But you can simply add to your error checking if(empty($_FILES['File'.$n]) die That was what caused me to post here. The problem with that, is that i need to count() the $_FILE array to be able to go through the arrays inside. and it won't let me do that if one file is too big, because $_FILE will be empty. Quote Link to comment 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.