progress in Calculate sha1

pull/234/head
qkqpttgf 2021-02-25 18:33:26 +08:00 committed by GitHub
parent 366a477ae2
commit 3aaa18ee59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1086,9 +1086,10 @@
return; return;
}*/ }*/
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
td2.innerHTML='计算SHA1 ...';
var reader = new FileReader(); var reader = new FileReader();
reader.readAsArrayBuffer(file); reader.onprogress = function(e) {
td2.innerText = '计算SHA1... ' + (e.loaded*100/file.size).toFixed(2) + " %";
}
reader.onload = function(e) { reader.onload = function(e) {
var filesha1 = sha1(this.result); var filesha1 = sha1(this.result);
<!--GuestStart--> <!--GuestStart-->
@ -1146,6 +1147,7 @@
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize); xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
} }
} }
reader.readAsArrayBuffer(file);
} }
uploadbuttonshow(); uploadbuttonshow();
} }