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

后端 未结 1 886
感动是毒
感动是毒 2021-02-20 13:06

Here is the thing,

I want cancel button similar to Basic plus UI or jQuery UI in Basic. This question might look silly to you. But actually i got confus

相关标签:
1条回答
  • 2021-02-20 13:18

    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
     })
    
    0 讨论(0)
提交回复
热议问题