BlueImp Jquery文件上传失败回调多次调用

时间:2013-06-21 17:56:14

标签: jquery jquery-file-upload

我正在使用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回调。否则一切正常

提前致谢

0 个答案:

没有答案