fix: one error stop the after in upload multy files
parent
b5f6032e2b
commit
097254f084
|
@ -817,19 +817,26 @@
|
|||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
getuplink(i);
|
||||
function getuplink(i) {
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
var td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
var td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
var td1;
|
||||
var td2;
|
||||
if (r==0) {
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
}
|
||||
var tdnum = timea+'_'+i;
|
||||
td1=document.getElementById('upfile_td1_'+tdnum);
|
||||
td2=document.getElementById('upfile_td2_'+tdnum);
|
||||
if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
|
@ -874,35 +881,46 @@
|
|||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.send(null);
|
||||
xhr1.onprogress = function(e){
|
||||
td2.innerHTML+='.';
|
||||
}
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
<!--GuestEnd-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
|
||||
}
|
||||
if (xhr1.status==200) {
|
||||
console.log(xhr1.responseText);
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
return;
|
||||
}
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
if (!html['uploadUrl']) {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
uploadbuttonshow();
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
|
||||
}
|
||||
}
|
||||
if (xhr1.status==409) {
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
tdnum = timea+'_'+i;
|
||||
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
xhr1.send(null);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
<!--GuestEnd-->
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
function size_format(num) {
|
||||
if (num>1024) {
|
||||
|
@ -995,7 +1013,7 @@
|
|||
}
|
||||
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
|
||||
label.innerHTML=StartStr+MiddleStr;
|
||||
uploadbuttonshow();
|
||||
// uploadbuttonshow();
|
||||
<!--AdminStart-->
|
||||
response.name=file.webkitRelativePath||response.name;
|
||||
addelement(response);
|
||||
|
@ -1018,7 +1036,7 @@
|
|||
} else {
|
||||
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
|
||||
}
|
||||
uploadbuttonshow();
|
||||
// uploadbuttonshow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue