Fix progress meter
This commit is contained in:
parent
f8e19b84b6
commit
cbfa13e426
@ -184,8 +184,9 @@ export default function () {
|
||||
xhr.upload.onprogress = (e) => {
|
||||
if (!e.lengthComputable) return;
|
||||
|
||||
bytesRead += e.loaded;
|
||||
setFileProgress(Math.floor((bytesRead / totalSize) * 100));
|
||||
setFileProgress(
|
||||
Math.floor(((bytesRead + e.loaded) / totalSize) * 100),
|
||||
);
|
||||
};
|
||||
xhr.upload.onabort = () => {
|
||||
shouldRecall = true;
|
||||
@ -197,9 +198,11 @@ export default function () {
|
||||
setUploading(false);
|
||||
setFileProgress(0);
|
||||
};
|
||||
xhr.upload.onloadend = () => {
|
||||
xhr.upload.onloadend = (ev) => {
|
||||
if (i === upload_urls.length - 1) setUploading(false);
|
||||
|
||||
bytesRead += ev.total;
|
||||
setFileProgress(bytesRead);
|
||||
resolve(null);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user