POST data disappears with large file uploads

I'm having problems with the file upload utility in my PHP application. When sending large files (9 MB +) on the form, I get a very strange behavior: the POST data that I included in the form disappears, including the file information.

I already increased all the PHP restrictions that I could (time limit, maximum input time, maximum message size, memory limit and maximum upload file size), and I still cannot get the correct behavior. I tried replacing regular HTTP forms with a flash solution (SWFUpload, www.swfupload.org), still the same behavior.

I tried several files with the same sizes and definitely not a specific problem with the file. I debugged POST files sent using Firebug, and the correct variables are still present in the header along with the file.

What can be done here?

+7
javascript html php forms uploading
source share
4 answers

Web servers can also be configured to limit request sizes. If you are using Apache, check out the LimitRequestBody directive.

+2
source share

try downloading small files of 1 - 2 MB in size. If you still canโ€™t post the code.

hope you added enctype = '/ multipart / form-data' to the form definition.

+1
source share

Ok, I think I have a solution. You should check both the post_max_size directive and $_SERVER['CONTENT_LENGTH'] , so if $ _SERVER ['CONTENT_LENGTH] exceeds post_max_size, then they are trying to load too much data.

 $POST_MAX_SIZE = ini_get('post_max_size'); $mul = substr($POST_MAX_SIZE, -1); $mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1))); if( $_SERVER['CONTENT_LENGTH'] > $mul*(int)$POST_MAX_SIZE && $POST_MAX_SIZE ) { $error = true; } 

The solution is taken here: http://www.php.net/manual/en/features.file-upload.php#73762

+1
source share

What server are you working on? I think some server OSs have a set limit on how large files they allow. This value can be changed.

0
source share

All Articles