Fix Getting $_FILES ERROR 3

Alright. its been a year of resting and facing the normal issue which I could easily google and get the answer out of everyone (as usual), but recently I faced this issue where my customer upload fails 'sometimes' and the error they are getting from $_FILES is 3 which is "The uploaded file was only partially uploaded."

Now, this is all good and great and should be easily be resolved but in the end, you get stuck for a long long time. Some of the solutions you can try are the following,

Ensure your PHP setup are correct. Such as the below config

upload_max_filesize=80M
post_max_size=80M
file_uploads = On
upload_tmp_dir = /tmp
max_file_uploads = 20
memory_limit=-1

and if these are correctly configured and you are still getting an issue and you are suspecting maybe its AWS load balancer or you might have a load balancer, you can forget that idea since its 'partial upload' error meaning, its uploaded but it gets 'terminated' suddenly. So the next possible candidate here would be the web server.

And since the customer was using an apache2 server. Do check the following to ensure they are not set to '0'.

Timeout 3000
KeepAlive On
MaxKeepAliveRequests 1000

My issue was that someone set Timeout to 0 and it causes this issue consistently. The other issue that you may face and get stuck would be that Timeout or MaxkeepAliveRequests is too short which cause error 3 to show up due to the web server cutting your users off during upload but not everyone gets cut off. Hence, you guys were unable to reproduce this consistently.

Hope this helps!

One thought on “Fix Getting $_FILES ERROR 3

Comments are closed.