jQuery-File-Upload cancel uploading by javascript

天大地大妈咪最大 提交于 2020-01-04 16:58:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!