keep getting upload php $_FILES error = 3 (partially uploaded)

Khaled Hasania picture Khaled Hasania · Aug 24, 2014 · Viewed 7.7k times · Source

I am using dropzone extension for Yii framework to upload some files by registered users. Everything working well but some users for some files that they trying to upload it's return error = 3 which it's happens when the uploaded file was only partially uploaded.

$file_error = $_FILES['Project']['error']['file'];
if ($file_error != 0) {
            mail('[email protected]', 'fileError',json_encode($_FILES['Project']));
}

i'am receiving a lot of emails from this function

JSON received

{"name":{"file":"3.jpg"},"type":{"file":""},"tmp_name":{"file":""},"error":{"file":3},"size":{"file":0}}

how can i debug this error and know the cases that make this error happened ?

This error happened 1- if the user refresh the page while uploading. 2- if the user cancel the upload (there is no cancel option in my site). 3- if the internet connection lost while uploading.

I'm still looking for other cases.

Answer

Felipe Q. B. picture Felipe Q. B. · Sep 22, 2019

in my case, the "partially uploaded" problem happened when uploading medium/large files using a slow internet connection.

The solution that works for me was set some Apache configurations in httpd.conf file:

TimeOut 300
KeepAliveTimeout 10
RequestReadTimeout handshake=0 header=20-1200,MinRate=200 body=20,MinRate=200

I hope it help.