问题
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.
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.
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.
Environment: LAMP, Centos 6.3.
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.
Uploader code:
<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>
EDIT: Console info:
[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}
回答1:
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.
In your php.ini, check to ensure that:
post_max_size
is set high enough to cover the file size (max 2G)
upload_max_filesize
is set high enough to cover the file size (max 2G)
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.
Other things to try in php.ini:
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.
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.
来源:https://stackoverflow.com/questions/16570246/fine-uploader-aborting-upload-with-file-is-empty-error