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? Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/ 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. Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416578 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 Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416580 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'. Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416789 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. Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416794 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 Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416796 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. Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-416806 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. Link to comment https://forums.phpfreaks.com/topic/81976-strange-behaviour-regarding-upload-small-code/#findComment-417348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.