Uploaded('+i+'/'+len+'),'+total_time+' ');if(len<=i){$("#totalProgress").html('Uploaded completed('+i+'/'+len+'), '+total_time+'
');bt_upload_file._files=[];$("#filesClose,#up,#opt").removeAttr("disabled");if(bt_upload_file.collback_to){bt_upload_file.collback_to(bt_upload_file.f_path)}return false}if(i>10){$("#up_box").scrollTop(35*(i-10)+50)}bt_upload_file._start_time=new Date();bt_upload_file._error=0;bt_upload_file.f=bt_upload_file._files[i];bt_upload_file.f_total=Math.ceil(bt_upload_file.f.size/bt_upload_file.split_size);bt_upload_file.upload(0,i)},upload:function(start,i){var end=Math.min(bt_upload_file.f.size,start+bt_upload_file.split_size);var len=bt_upload_file._files.length;var f_path=bt_upload_file.f_path;if(bt_upload_file.f.webkitRelativePath){f_path=bt_upload_file.f_path+'/'+bt_upload_file.f.webkitRelativePath.replace('/'+bt_upload_file.f.name,'')}var form=new FormData();form.append("f_path",f_path.replace('//','/'));form.append("f_name",bt_upload_file.f.name);form.append("f_size",bt_upload_file.f.size);form.append("f_start",start);form.append("blob",bt_upload_file.f.slice(start,end));$.ajax({url:bt_upload_file.upload_url,type:"POST",data:form,async:true,processData:false,contentType:false,success:function(data){if(typeof(data)==="number"){var progress=parseInt(data/bt_upload_file.f.size*100);var total_time=bt_upload_file.diff_time(bt_upload_file._t_start_time,new Date());$("#totalProgress").html('Uploaded('+i+'/'+len+'),'+total_time+'
');$("#up_box li em")[i].outerHTML='Upload progress:'+progress+'%';$("#up_box li .filesize")[i].outerHTML=''+bt_upload_file.to_size(data)+'/'+bt_upload_file.to_size(bt_upload_file.f.size)+'';$("#up_box li em")[i].focus();bt_upload_file.upload(data,i)}else{if(data.status){var f_time=bt_upload_file.diff_time(bt_upload_file._start_time,new Date());$("#up_box li em")[i].outerHTML='Completed('+f_time+')';$("#up_box li .filesize")[i].outerHTML=''+bt_upload_file.to_size(bt_upload_file.f.size)+'/'+bt_upload_file.to_size(bt_upload_file.f.size)+''}else{$("#up_box li em")[i].outerHTML=''+data.msg+''}bt_upload_file.start(i+1)}},error:function(e){if(bt_upload_file._error>5){$("#up_box li em")[i].outerHTML='Upload failed';bt_upload_file.start(i+1);return}bt_upload_file._error+=1;bt_upload_file.upload(start,i)}})},diff_time:function(start_date,end_date){var diff=end_date.getTime()-start_date.getTime();var minutes=Math.floor(diff/(60*1000));var leave3=diff%(60*1000);var seconds=(leave3/1000).toFixed(2);var result=seconds+'sec';if(minutes>0){result=minutes+"min"+result}return result}};