我有以下手动激活上传器的实例:
var manualuploader = new qq.FineUploader({
element: $('#jquery-wrapped-fine-uploader')[0],
request: {
endpoint: '/data/assets/ajax/uploader.php'
},
autoUpload: false,
text: {
uploadButton: '<i class="icon-plus icon-white"></i> Select Files to upload'
},
chunking: {
enabled: true,
partSize: 50000000
},
resume: {
enabled: true
},
debug: true,
callbacks: {
onComplete: function (id, fileName, response) {
$('#uploader').append('<input type="hidden" name="fileasdf[]" value="' + response.originalName + '" />');
submitForm.call(this);
},
onError: function (event, id, name, errorReason, xhrOrXdr) {
alert(qq.format("Error on file number {} - {}. Reason: {}", id, name, errorReason));
}
}
});
$('#triggerUpload').click(function() {
manualuploader.uploadStoredFiles();
});
我指定了一个块文件夹,我可以看到块已上载。文件上载过程正常完成。
但是,在取消或意外终止的情况下,上载不会继续。块仍然存在于目录中,所有标准浏览器cookie都已启用,但恢复不会发生。
分块调试输出如下。我上传了几个块,取消并重新尝试上传:
[Fine Uploader 4.4.0] Sending chunked upload request for item 1: bytes 1-50000000 of 346011648 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] xhr - server response received for 1 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] responseText = {"success":true,"uploadName":null} fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Received response status 200 with body: {"success":true,"uploadName":null} fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Sending chunked upload request for item 1: bytes 50000001-100000000 of 346011648 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] xhr - server response received for 1 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] responseText = {"success":true,"uploadName":null} fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Received response status 200 with body: {"success":true,"uploadName":null} fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Sending chunked upload request for item 1: bytes 100000001-150000000 of 346011648 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Detected valid file button click event on file 'CentOS-6.3-x86_64-minimal.iso', ID: 1. fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Cancelling 1 fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Caught exception in 'onError' callback - Cannot read property 'length' of undefined fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Received 1 files or inputs. fineuploader-4.4.0.min.js:25
[Fine Uploader 4.4.0] Sending chunked upload request for item 2: bytes 1-50000000 of 346011648
知道为什么会这样吗?
我还有一个与问题无关的问题。对于onComplete回调,我只想启动submitForm.call(this)函数(它提交表单)。但是,如果我只指定
onComplete: submitForm.call(this)
因为抛出错误,表示未定义onComplete响应。。。
为赛格威道歉,再次感谢。