aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Guyonvarch2026-01-01 17:35:53 +0100
committerJoris Guyonvarch2026-01-01 17:35:53 +0100
commitbe94934ccd7d144cd30f6029941d5d835e29746d (patch)
treef39ec4781896f60ca2574b7a49689be91a2de982
parent9c179d5dc672480b78d45edc23441daade33c1c4 (diff)
Fix upload progress
-rw-r--r--src/static/main.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/static/main.js b/src/static/main.js
index 3a62743..892ca95 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -30,12 +30,12 @@ window.onload = function() {
setTimeout(function() {
const xhr = new XMLHttpRequest()
xhr.open('POST', '/upload', true)
- xhr.onprogress = function (event) {
+ xhr.upload.addEventListener('progress', function(event) {
if (event.lengthComputable) {
- const pct = (event.loaded / event.total) * 100;
+ const pct = Math.round((event.loaded / event.total) * 100)
loadingPct.innerText = `${pct} %`
}
- }
+ }, false)
xhr.onload = function () {
if (xhr.status === 200) {
window.location = `/share/${xhr.responseText}`