2015-02-11 106 views
0

我正在關注basic plus演示,幾乎到了tee,並且無法使進度條正常工作。下載console.log下載按鈕點擊返回100%。Blueimp jQuery上傳進度 - 直接到100%

$('#fileupload').fileupload({ 
     url: url, 
     dataType: 'json', 
     autoUpload: false, 
     acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf)$/i, 
     maxFileSize: 5000000, // 5 MB 
     // Enable image resizing, except for Android and Opera, 
     // which actually support image resizing, but fail to 
     // send Blob objects via XHR requests: 
     disableImageResize: /Android(?!.*Chrome)|Opera/ 
      .test(window.navigator.userAgent), 
     previewMaxWidth: 100, 
     previewMaxHeight: 100, 
     previewCrop: true, 
     formData:function(form){ 
      //get file name 
      var $this = this; 
      var formSelector = 'form-' + $($this.files)[0].name.replace(/\W/g,'-'); 
      return $('.'+formSelector).serializeArray(); 
     }, 
     progressall:function(e,data){ 
      var progress = parseInt(data.loaded/data.total * 100, 10); 
      $('#progress .progress-bar').css('width', progress + '%'); 
      console.log(progress); 
     } 
    }) 

回答

0

由於上傳速度很快,因此進度立即達到100%。當我上傳一個更大的文件時,進度看起來正常。

1

這不是真的!
當我嘗試上傳一個小文件時,進度條吹到100%,但是從Chrome控制檯請求仍在(待定)狀態,表示上傳仍在運行!

+0

我不知道這篇文章的解決方案是否解釋了這種情況:http://stackoverflow.com/questions/14691236/largegap-between-last-file-progress-hitting-100-and-the-stop-done -events – 2015-10-30 18:26:43

相關問題