我试图设置plupload,以便如果一个文件上传失败,根据一定的错误代码,plupload将尝试再次上传它。但没有成功。
我现在拥有的
下面是我现在的代码:
var attempts = 0; // number of attempts
function init(uploader) {
uploader.bind('Error', function(up, file) {
var code = JSON.parse(file.response).error.code;
console.log(code); //logs the error code
if(code === 503 && attempts > 3) {
up.stop();
file.status = plupload.FAILED;
file.retry = false;
// do stuff...
up.state = plupload.STARTED;
up.trigger("StateChanged");
attempts = 0;
}
else {
console.log("attempt : "+ attempts);
up.stop();
file.status = plupload.QUEUED;
attempts++;
file.retry = true;
up.state = plupload.STARTED;
up.trigger("StateChanged");
up.trigger("QueueChanged"); // ERROR HERE
}
})
}当我指出“这里的错误”时,我的控制台向我展示了以下内容:
TypeError: n.getSource不是一个函数
我做错什么了?
非常感谢!
发布于 2015-06-27 14:07:31
为什么不将文件再次添加到队列中呢?http://www.plupload.com/docs/Uploader#addFile-filefileName-method
addFile(file, [fileName])https://stackoverflow.com/questions/31088932
复制相似问题