使用jQuery file upload,不确定可能出现的问题,但我无法重新添加已取消到队列中的文件。
对于同一文件,不会再次调用add
回调。如果我尝试上传另一个文件,则会调用它。
这是我的初始化:
$('#fileupload').fileupload({
autoUpload: false,
disableImageResize: /Android(?!.*Chrome)|Opera/.test(window.navigator.userAgent),
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
replaceFileInput: false,
singleFileUploads: false,
maxNumberOfFiles: 1,
dropZone: null
});
答案 0 :(得分:0)
只有在设置replaceFileInput: false
时才会出现此问题。
要解决这个问题,我必须添加以下一行代码:
...
else {
deferred = that._addFinishedDeferreds();
that._transition($(this)).done(
function () {
$(this).remove();
that._trigger('failed', e, data);
that._trigger('finished', e, data);
deferred.resolve();
}
);
}
为:
...
else {
deferred = that._addFinishedDeferreds();
that._transition($(this)).done(
function () {
$('input[type=\"file\"]').val('');
$(this).remove();
that._trigger('failed', e, data);
that._trigger('finished', e, data);
deferred.resolve();
}
);
}