From be94934ccd7d144cd30f6029941d5d835e29746d Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Thu, 1 Jan 2026 17:35:53 +0100 Subject: Fix upload progress --- src/static/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/static') 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}` -- cgit v1.2.3