diff --git a/app/classes/web/upload_handler.py b/app/classes/web/upload_handler.py index 0d9e00e5..90d59892 100644 --- a/app/classes/web/upload_handler.py +++ b/app/classes/web/upload_handler.py @@ -62,16 +62,18 @@ class UploadHandler(tornado.web.RequestHandler): def post(self): logger.info("Upload completed") - + files_left = int(self.request.headers.get('X-Files-Left', None)) if self.do_upload: time.sleep(5) - websocket_helper.broadcast('close_upload_box', 'success') + if files_left == 0: + websocket_helper.broadcast('close_upload_box', 'success') self.finish('success') # Nope, I'm sending "success" self.f.close() else: time.sleep(5) - websocket_helper.broadcast('close_upload_box', 'error') + if files_left == 0: + websocket_helper.broadcast('close_upload_box', 'error') self.finish('error') def data_received(self, data): diff --git a/app/frontend/templates/panel/server_files.html b/app/frontend/templates/panel/server_files.html index 24476d5c..aedd93f2 100644 --- a/app/frontend/templates/panel/server_files.html +++ b/app/frontend/templates/panel/server_files.html @@ -525,7 +525,7 @@ window.location.href = "/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=files" } - function sendFile(file, path, server_id, onProgress){ + function sendFile(file, path, server_id, left, onProgress){ var xmlHttpRequest = new XMLHttpRequest(); var token = getCookie("_xsrf") var fileName = file.name @@ -537,6 +537,7 @@ xmlHttpRequest.setRequestHeader('X-XSRFToken', token); xmlHttpRequest.setRequestHeader('X-Content-Disposition', 'attachment; filename="' + fileName + '"'); xmlHttpRequest.setRequestHeader('X-Path', path); + xmlHttpRequest.setRequestHeader('X-Files-Left', left); xmlHttpRequest.setRequestHeader('X-FileName', fileName); xmlHttpRequest.setRequestHeader('X-ServerId', "{{ data['server_stats']['server_id']['server_id'] }}"); xmlHttpRequest.upload.addEventListener('progress', (event) => @@ -583,17 +584,18 @@ label: "Upload", className: "btn-default", callback: async function () { + var height = files.files.length*50; + + var waitMessage = '
'+
+ ''+
+ 'Please wait while we upload your files... This may take a while.
'+
+ 'DO NOT CLOSE THIS PAGE.'+
+ '
-
- Please wait while we upload your files... This may take a while.
- DO NOT CLOSE THIS PAGE.
-