keep get upload php $_FILES error = 3(部分上传)


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

我使用dropzone扩展为Yii框架上传一些文件注册用户。一切都很好,但有些用户试图上传的文件返回错误= 3,这发生在上传的文件只是部分上传的时候。

$file_error = $_FILES['Project']['error']['file'];
if ($file_error != 0) {
            mail('myemail@gmail.com', 'fileError',json_encode($_FILES['Project']));
}

我收到了很多来自这个函数的电子邮件

收到JSON

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

我如何调试这个错误并知道使这个错误发生的情况?

错误发生1-如果用户在上传时刷新页面。2-如果用户取消上传(在我的网站没有取消选项)。3-上传时网络连接丢失

我还在找其他案例

在我的案例中,使用慢速网络上传大中型文件时出现了"部分上传"问题。

我的解决方案是在httpd.conf文件中设置一些Apache配置:

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

正如php文档所说,这个错误是

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).

还有一些变体需要检查:

  1. 权限错误(我怀疑,因为它会破坏所有用户)

  2. 服务器空间不足

  3. 从iOS上传时出现此错误

  4. 上传文件夹时可能出现此错误(由于浏览器限制)。

所以这是可能要检查的错误。