From 54643c4c4cbaa47cd99245c6826f4a78b47229e3 Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Sat, 20 Jan 2018 17:02:32 +0100 Subject: Multiple file uploads at once --- html/index.html | 2 +- html/webbox.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'html') diff --git a/html/index.html b/html/index.html index 40390e0..80fa1d8 100644 --- a/html/index.html +++ b/html/index.html @@ -15,7 +15,7 @@ - + diff --git a/html/webbox.js b/html/webbox.js index 5a55010..72ff987 100644 --- a/html/webbox.js +++ b/html/webbox.js @@ -526,11 +526,11 @@ function onUploadFile() { if (this.status != 200) { message = "HTTP error"; } else { - if (xhr.responseText == "OK") { + if (xhr.responseText == "") { message = "Upload successful."; loadContents(currentDir); // load new file list with uploaded file } else { - message = "Error: " + xhr.responseText; + message = xhr.responseText; } } @@ -544,11 +544,14 @@ function onUploadFile() { progressOff(); } + progressOn(); + var uploadfile = document.getElementById("uploadfile"); var formData = new FormData(); - formData.append("uploadfile", uploadfile.files[0]); - progressOn(); + for (var i = 0; i < uploadfile.files.length; i++) { + formData.append("uploadfile", uploadfile.files[i]); + } xhr.open("POST", "/bin/query" + currentDir + "?command=upload", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); -- cgit v1.2.3