uploading via http post (multipart/form-data) silently fails with big files

Posted by matteo on Server Fault See other posts from Server Fault or by matteo
Published on 2011-11-28T19:09:20Z Indexed on 2013/10/30 3:58 UTC
Read the original article Hit count: 583

Filed under:
|
|
|
|

When uploading multipart/form-data forms via a http post request to my apache web server, very big files (i.e. 30MB) are silently discarded. On the server side all looks as if the attached file was received with 0 bytes size. On the client side all looks like it had been uploaded succesfully (it takes the expected long time to upload and the browser gives no error message).

On the server, nothing is logged into the error log. An entry is logged into the access log as if everything was ok (a post request and a 200 ok response). These uploads are being posted to a php script. In the php script, If I print_r $_FILES, I see the following information for the relevant file:

[file5] => Array
        (
            [name] => MOV023.3gp
            [type] => video/3gpp
            [tmp_name] => /tmp/phpgOdvYQ
            [error] => 0
            [size] => 0
        )

Note both [error] => 0 (which should mean no error) and [size] => 0 (as if the file was empty).

My php script runs fine and receives all the rest of the data except these files. move_uploaded_file succeeds on these files and actually copies them as 0byte files.

I've already changed the php directives max_upload_size to 50M and post_max_size to 200M, so neither the single file nor the request exceed any size limit.

max_execution_time is not relevant, because the time to transfer the data does not count; and I've increased max_input_time to 1000 seconds, though this shouldn't be necessary since this is the time taken to parse the input data, not the time taken to upload it.

Is there any apache configuration, prior to php, that could be causing these files to be discarded even prior to php execution? Some limit in size or in upload time?

I've read about a default 300 seconds timeout limit, but this should apply to the time the connection is idle, not the time it takes while actually transferring data, right?

Needless to say, uploads with all exactly identical conditions (including file format, client and everything) except smaller file size, work seamlessly, so the issue is clearly related to the file or request size, or to the time it takes to send it.

© Server Fault or respective owner

Related posts about apache2

Related posts about php