diff options
| author | Joris Guyonvarch | 2026-01-01 17:35:53 +0100 |
|---|---|---|
| committer | Joris Guyonvarch | 2026-01-01 17:35:53 +0100 |
| commit | be94934ccd7d144cd30f6029941d5d835e29746d (patch) | |
| tree | f39ec4781896f60ca2574b7a49689be91a2de982 | |
| parent | 9c179d5dc672480b78d45edc23441daade33c1c4 (diff) | |
Fix upload progress
| -rw-r--r-- | src/static/main.js | 6 |
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}` |
