@@ -164,19 +164,19 @@
@@ -352,7 +352,7 @@
var file;
function sendFile() {
file = $("#file")[0].files[0]
- document.getElementById("upload_input").innerHTML = '
';
+ document.getElementById("upload_input").innerHTML = '
';
let xmlHttpRequest = new XMLHttpRequest();
let token = getCookie("_xsrf")
let fileName = file.name
@@ -361,6 +361,15 @@
let size = file.size
let type = 'background'
+ xmlHttpRequest.upload.addEventListener('progress', function (e) {
+
+ if (e.loaded <= size) {
+ var percent = Math.round(e.loaded / size * 100);
+ $(`#upload-progress-bar`).css('width', percent + '%');
+ $(`#upload-progress-bar`).html(percent + '%');
+ }
+ });
+
xmlHttpRequest.open('POST', target, true);
xmlHttpRequest.setRequestHeader('X-Content-Type', mimeType);
xmlHttpRequest.setRequestHeader('X-XSRFToken', token);
diff --git a/app/frontend/templates/server/bedrock_wizard.html b/app/frontend/templates/server/bedrock_wizard.html
index 38d0b021..1f10314b 100644
--- a/app/frontend/templates/server/bedrock_wizard.html
+++ b/app/frontend/templates/server/bedrock_wizard.html
@@ -562,7 +562,7 @@
var file;
function sendFile() {
file = $("#file")[0].files[0]
- document.getElementById("upload_input").innerHTML = '
'
+ document.getElementById("upload_input").innerHTML = '
'
let xmlHttpRequest = new XMLHttpRequest();
let token = getCookie("_xsrf")
let fileName = encodeURIComponent(file.name)
@@ -571,6 +571,15 @@
let size = file.size
let type = 'server_import'
+ xmlHttpRequest.upload.addEventListener('progress', function (e) {
+
+ if (e.loaded <= size) {
+ var percent = Math.round(e.loaded / size * 100);
+ $(`#upload-progress-bar`).css('width', percent + '%');
+ $(`#upload-progress-bar`).html(percent + '%');
+ }
+ });
+
xmlHttpRequest.open('POST', target, true);
xmlHttpRequest.setRequestHeader('X-Content-Type', mimeType);
xmlHttpRequest.setRequestHeader('X-XSRFToken', token);
diff --git a/app/frontend/templates/server/wizard.html b/app/frontend/templates/server/wizard.html
index 0f70d6b1..ac5b5d9a 100644
--- a/app/frontend/templates/server/wizard.html
+++ b/app/frontend/templates/server/wizard.html
@@ -804,7 +804,7 @@
var file;
function sendFile() {
file = $("#file")[0].files[0]
- document.getElementById("upload_input").innerHTML = '
'
+ document.getElementById("upload_input").innerHTML = '
'
let xmlHttpRequest = new XMLHttpRequest();
let token = getCookie("_xsrf")
let fileName = file.name
@@ -813,6 +813,15 @@
let size = file.size
let type = 'server_import'
+ xmlHttpRequest.upload.addEventListener('progress', function (e) {
+
+ if (e.loaded <= size) {
+ var percent = Math.round(e.loaded / size * 100);
+ $(`#upload-progress-bar`).css('width', percent + '%');
+ $(`#upload-progress-bar`).html(percent + '%');
+ }
+ });
+
xmlHttpRequest.open('POST', target, true);
xmlHttpRequest.setRequestHeader('X-Content-Type', mimeType);
xmlHttpRequest.setRequestHeader('X-XSRFToken', token);