2017-06-06 18 views
0

我使用jQuery文件上傳blueimp(基本型UI)上傳數據,jQuery的文件上傳Blueimp - 取消事件(和計數總電流上傳前映像)

我關注的是取消按鈕,如:當我預先上傳3張圖片,然後我取消了所有的圖片,所以表格行將是空的, 我想在該動作後顯示'沒有圖片選擇'作爲默認表格行(tr)。

我發現取消事件是在jquery-fileupload-ui.js。

_cancelHandler: function (e) {     
     e.preventDefault();    
     var template = $(e.currentTarget) 
       .closest('.template-upload,.template-download'), 
      data = template.data('data') || {}; 
     data.context = data.context || template;      

     if (data.abort) { 
      data.abort(); 
     } else { 
      data.errorThrown = 'abort'; 
      this._trigger('fail', e, data); 
     }        
    }, 

我怎麼能知道上傳前的文件數,所以噹噹前上傳前文件是空的,我會追加HTML表「沒有選擇的圖像」,

你的幫助會完美的事情

回答

0

您可以使用事件失敗:

$('#TestForm').fileupload({ 
    dataType : 'json', 
    autoUpload : false, 
    add : function(e, data) { 
     // do something 
    }, 
    fail : function(e, data) { 
     // do what do you want when upload canceled or other problem 
    } 
) 
}); 
相關問題