问题
I am using jQuery-File-Upload https://github.com/blueimp/jQuery-File-Upload and i want to implement cancel uploading on click of cancel button manually, i know there is a callback "fileuploadfail" but can anyone give example how we use it.
回答1:
Implement Cancel event
using below code
var jqXHR = $('#fileupload').fileupload('send', {files: filesList})
.error(function (jqXHR, textStatus, errorThrown) {
if (errorThrown === 'abort') {
alert('File Upload has been canceled');
}
});
$('button.cancel').click(function (e) {
jqXHR.abort();
});
来源:https://stackoverflow.com/questions/27752020/jquery-file-upload-cancel-uploading-by-javascript