2013-06-06 35 views
1

uplodifive 플러그인을 사용하여 올바르게 작동하는 여러 파일을 업로드하지만 진행 표시 줄에 고정되어 있습니다. 내가 뭘 이런 onProgressevent의 도움으로 결정하기 쉬운 하나의 파일에 대한 총 업로드 여러 파일의 퍼센트모든 파일을 uplodifive로 큐에서 함께 업로드

표시 할 수 있습니다

var percent = Math.round((e.loaded/e.total) * 100); 

을하지만 난 전체 퍼센트를 계산하려면 여러 파일에 대해, 나는 또한 여러 파일에 대해 uplodifive 작품이 하나씩 차례로 확인해 보았다.

모든 파일의 총 백분율을 얻을 수 있도록 모든 파일을 함께 업로드 할 수 있습니까?

스크린 샷에서 기본 업로드 파일을 하나씩로드합니다. 파일을 함께 업로드하고 싶습니다.

enter image description here

$('#fileElem').uploadifive({ 
       'auto'    : false, 
       'height'   : 20, 
       'width'    : 75, 
       'truncateLength' : 27, 
       'queueID'   : 'fl-que', 
       'simUploadLimit' : 0, 
       'onSelect'   : function(){ selectHandle(); }, 
       'onCancel'   : function(){ if($('#fl-que > div').length == 1){ cancelHandle(); } }, 
       'buttonText'  : '<span class="plus_icon">+</span> <span class="txt">Add Files</span>', 
       'uploadScript'  : '/wp_themes/itrnsfr/uploadifive.php', 
       'onProgress'  : function(file, e){ progressHandle(file, e); }, 
       'onUploadComplete' : function(){ uploadCompleteHandle(); } 
     }); 


    function progressHandle(file, e){ 
      //console.log(file); 
      //console.log(e); 
      if(e.lengthComputable){ 
       box.eq(0).hide(); // Hide main uploader 
       box.eq(1).show(); // Display progress bar 
       box.eq(2).hide(); // Hide the complete MSG 

       var percentComplete = Math.round((e.loaded/e.total) * 100); 

       $('#loader_val').text(percentComplete + '%'); 
       var jmeter = ("0." + (percentComplete <= 9 ? "0" + percentComplete : (percentComplete == 100) ? "99" : percentComplete)); 
       PG.change({size: parseFloat(jmeter)}); 
       $('.trnsfr-ratio').text(unitConversion(e.position)); 
      } 


     } 

답변

1

사용 OnUploadProgress :

HTML :

<input type="file" name="file_upload" id="file_upload" /> 
<div id="progress"></div> 

JS :

$(function() { 
    $("#file_upload").uploadify({ 
     'swf'    : '/uploadify/uploadify.swf', 
     'uploader'   : '/uploadify/uploadify.php', 
     'onUploadProgress' : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { 
      $('#progress').html(totalBytesUploaded + ' bytes uploaded of ' + totalBytesTotal + ' bytes.'); 
     } 
    }); 
}); 
+0

감사뿐만 아니라 파일 하나 하나, 모든 함께 업로드 : ( –

+0

'(totalBytesUploaded/totalBytesTotal) * 100'은 총 진행률을 표시해야합니다. –

+0

Uploadify가 업로드되지 않습니다. OnUploadProgress는 Uploadifive에 없습니다. – mathius1