Keep getting php download $ _FILES error = 3 (partially downloaded)
I am using dropzone extension for Yii framework to upload some files by registered users. Everything works well, but some users return error = 3 for some files they try to download, which happens when the downloaded file was only partially downloaded.
$file_error = $_FILES['Project']['error']['file'];
if ($file_error != 0) {
mail('myemail@gmail.com', 'fileError',json_encode($_FILES['Project']));
}
I get 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 find out the cases in which this error occurred?
This error occurred 1- if the user refreshes the page while loading. 2- if the user canceled the upload (there is no cancellation option on my site). 3- if internet connection is lost while downloading.
I am still looking for other cases.
source to share
As php documentation says this error
UPLOAD_ERR_PARTIAL is given when the mime boundary is not found after the file data.
A possibly cause for this is that the upload was cancelled by the user (pressed ESC, etc).
There are also several verification options:
-
The permissions are wrong (I doubt this will break all users).
-
Insufficient free space on the server.
-
This error occurs when downloading from iOS.
-
This error can occur when loading a folder (due to browser restrictions). On Mac OSX, it reaches 100%.
So these are possible errors to check. Hope this helps.
source to share
in my case the "partially loaded" problem occurred while downloading medium / large files using a slow internet connection.
The solution that worked for me had multiple Apache configurations set in the httpd.conf file:
TimeOut 300
KeepAliveTimeout 10
RequestReadTimeout handshake=0 header=20-1200,MinRate=200 body=20,MinRate=200
I hope this helps.
source to share