2016-05-06 45 views
2

我想在dropzone中啓動上傳時禁用按鈕,並在完成文件上傳後啓用該按鈕。在DropZone中上傳文件時禁用按鈕

我可以在成功事件中啓用按鈕。但開始上傳後;哪些事件我可以禁用按鈕?

我的代碼是

//Simple Dropzonejs 
     $("#dZUpload").dropzone({ 
      url: "hn_SimpeFileUploader.ashx", 
      maxFiles: 100, 
      maxFilesize: 2, 
      addRemoveLinks: false, 
      acceptedFiles: "application/pdf", 
      autoProcessQueue: false,     
      success: function(file, response) { 
        var submit2 = document.getElementById('<%= UploadButton.ClientID %>'); 
        submit2.disabled = false;  
       var imgName = response; 
       file.previewElement.classList.add("dz-success"); 
       console.log("Successfully uploaded :" + imgName); 

       var totalfilesize = 0; 
       var obj = {}; 
       obj.name = file.name; 
       $.ajax({ 
        type: "POST", 
        url: "DUpload.aspx/SendP", 
        data: JSON.stringify(obj), 
        contentType: "application/json; charset=utf-8", 
        dataType: "json", 
        success: function(r) { 
         //alert(r.d); 
        } 
       }); 

      }, 
      error: function(file, response) { 
       file.previewElement.classList.add("dz-error"); 
      } 
     }); 


    }); 
+0

但是,這裏是代碼? –

+0

@PranavPatel plz立即檢查。 – Jkrish

+0

['addedfile'](http://www.dropzonejs.com/#event-addedfile)和['complete'](http://www.dropzonejs.com/#event-complete)事件如何.. – Rayon

回答

0

您可以使用上傳進度的事件,並檢查進度爲100 上傳進度有三個參數:(文件,進程,bytesSent)

相關問題