Fix reload page before all file uploaded bug (#3534)

This commit is contained in:
Rain Li 2022-08-28 22:51:47 +08:00 committed by GitHub
parent cc0c8c5f81
commit 089446f5b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,12 +288,12 @@
function uploadFile(file, i) { function uploadFile(file, i) {
var url = window.location.href; var url = window.location.href;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var fileName = file.name;
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) { if (xhr.readyState == XMLHttpRequest.DONE) {
location.reload(); finishUpload(fileName)
} }
} }
var fileName = file.name;
xhr.upload.addEventListener('progress', function(e) { xhr.upload.addEventListener('progress', function(e) {
if (e.lengthComputable) { if (e.lengthComputable) {
var percent = Math.ceil((e.loaded / e.total) * 100); var percent = Math.ceil((e.loaded / e.total) * 100);