Fine-Uploader中止带有“文件为空"的上传错误 [英] Fine-Uploader aborting upload with 'File is empty' error

查看:100
本文介绍了Fine-Uploader中止带有“文件为空"的上传错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用非jQuery依赖的FineUploader和PHP示例错误报告脚本来上传文件.分块和恢复已打开.所有处理均来自PHP示例脚本,未经任何修改.

I'm using non-jQuery dependent FineUploader with the PHP example error-reporting script to upload a file. Chunking and resuming are turned on. All handling is from the PHP example scripts without any modifications.

可以成功处理最大约90mb的测试文件,但是,当尝试上传329mb的文件时,上传开始,但是由于文件为空"错误而中止.

Works successfully on test files of up to ~90mb, however when attempting to upload a file of 329mb, the upload begins but then aborts with the 'File is empty' error.

我从我的chunk文件夹中看到,在错误发生之前大约上传了77mb的文件.恢复尝试不起作用,并且不会增加块目录的大小.

I can see from my chunk folder that approximately 77mb of the file was uploaded before the error. Attempts to resume do not work and do not increase the size of the chunk directory.

环境:LAMP,Centos 6.3.

Environment: LAMP, Centos 6.3.

post_max_sizeupload_max_filesize在php.ini中都设置为2048M.

post_max_size and upload_max_filesize both set to 2048M in php.ini.

关于此原因的任何指示吗?乐意提供其他信息.

Any indiciation as to the cause of this? Happy to provide additional information.

上传者代码:

<div id="failed-fine-uploader"></div>

<script>
function createUploader() {
var faileduploader = new qq.FineUploader({
element: document.getElementById('failed-fine-uploader'),
request: {
    endpoint: 'example.php'
},
chunking: {
      enabled: true
},
resume: {
      enabled: true
},
failedUploadTextDisplay: {
    mode: 'custom',
    maxChars: 40,
    responseProperty: 'error',
    enableTooltip: true
}
}); 
}
window.onload = createUploader;
</script>

控制台信息:

[17:31:09.314] [FineUploader] Processing 1 files or inputs...
[17:31:09.315] [FineUploader] Resuming CentOS-6.3-x86_64-minimal.iso at partition index 40
[17:31:09.316] [FineUploader] Sending chunked upload request for item 4: bytes 80000001-82000000 of 346011648
[17:31:09.504] [FineUploader] xhr - server response received for 4
[17:31:09.504] [FineUploader] responseText = {"error":"File is empty.","uploadName":null}

推荐答案

如果遇到此错误(相当无济于事),则可能有很多原因,因此建议您全部检查一下.这个答案是在似乎发生此错误的很大"文件的情况下进行的.

If you are experiencing this (rather unhelpful) error, it could be a number of things, so I'd advise checking them all. This answer is in the context of 'very large' files where this error seems to occur.

在您的php.ini中,检查并确保:

In your php.ini, check to ensure that:

post_max_size设置得足够高,可以覆盖文件大小(最大2G)

post_max_size is set high enough to cover the file size (max 2G)

upload_max_filesize设置得足够高,可以覆盖文件大小(最大2G)

upload_max_filesize is set high enough to cover the file size (max 2G)

post_max_size大于upload_max_filesize(如 http://www.php.net/manual/en/ini.core.php#ini.post-max-size ),并且memory_limit大于post_max_size .这些因素中的任何一个都可能导致$_FILES超全局变量返回为空,并错误地上载.

That post_max_size is larger than upload_max_filesize (as recommended by http://www.php.net/manual/en/ini.core.php#ini.post-max-size), and that memory_limit is larger than post_max_size. Any of these factors could result in the $_FILES superglobal returning as empty, and erroring out the upload.

要在php.ini中尝试的其他方法:

Other things to try in php.ini:

增加max_execution_time以考虑上载的持续时间(大文件通常比默认值30更长),并且max_input_time也相应增加.

That max_execution_time is increased to take in to account the duration of the upload (large files typically take longer than the default of 30), and max_input_time is also increased accordingly.

您可能还需要使用LimitRequestBody指令修改httpd.conf,因为这可能会覆盖php.ini中指定的任何内容.它以字节为单位指定,可以直接在httpd.conf或.htaccess文件中指定(假设您具有Override特权).您也可以按目录(出于安全性)进行指定,如下所示.

You may also need to modify your httpd.conf with the LimitRequestBody directive as this may be overriding anything specified in php.ini. This is specified in bytes and can be specified either directly in httpd.conf or in a .htaccess file (assuming you have Override priviliges). You can also specify this on a per-directory basis (for security) as follows.

<Directory "/var/www/myuploaddir/">
        LimitRequestBody 1073741824
</Directory>

最后,还要确保您有足够的临时和非临时存储空间来上传文件.该软件包不会捕获空间不足"错误.

Finally, also ensure that you have sufficient temporary and non-temporary storage for the file being uploaded. The package does not catch 'out of space' errors.

这篇关于Fine-Uploader中止带有“文件为空"的上传错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆