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