How to remove file from the queue to stop upload before upload starts in blueimp Basic?

て烟熏妆下的殇ゞ 提交于 2019-12-04 02:22:53

You can add an "upload" and "cancel" button to every file and bind the submit function on these buttons.

var cancel_btn = $('<button/>')
    .addClass('btn btn-warning cancel pull-right')
    .html('<i class="icon-ban-circle icon-white"></i><span> Cancel')
var upload_btn = $('<button/>')
    .addClass('btn btn-warning upload pull-right')
    .html('<i class="icon-ban-circle icon-white"></i><span> Upload')
    });
 $('#submit').on('click',function(){
     $('.upload').click() //click upload buttons and upload all files in the queue
 })
 $('#cancel').on('click',function(){
     $('.cancel').click() //click cancel buttons and remove all files in the queue
 })
 .......
 $('#files_list tbody').append(tr);
 $(td4).append(upload_btn.clone(true).data(data));
 $('.upload').eq(-1).on('click',function(){//button to upload only this file
      data.submit();
 })
 $('.cancel').eq(-1).on('click',function(){
      $(this).parent().parent().remove()//or something like this, 
                                        //delete the whole <tr> 
                                        //and remove the file from the queue
 })
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!