我正在使用BlueImp的jQuery fileupload
var fileInput = $('#'+file_up_id+'_select');
var fileUploadObj = $(fileInput).fileupload({
url: file_up_submitUrl,
dataType: 'json',
maxNumberOfFiles:1,
autoUpload: false,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
})
.on('fileuploadadd',onFileSelect)
.on('fileuploadprogressall',onFileUploadProgress)
.on('fileuploaddone',onFileUploadDone)
.on('fileuploadfail',onFileUploadFail);
onFileUploadProgress=function (e, data) {
uploadProgress = parseInt(data.loaded / data.total * 100, 10);
}
onFileUploadFail=function (e, data) {
console.log("failed");
}
onFileUploadDone=function (e, data) {
console.log("done");
}
HTML
<form method='POST' enctype='multipart/form-data' >
<b>Select a file</b><input type='file' id='myImgUpload_select' name='files[]' single />
</form>
我的问题是当上传失败时,会多次调用fileuploadfailed回调。否则一切正常
提前致谢