aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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}`