aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/js/files.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/js/files.js')
-rw-r--r--src/main/resources/js/files.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js
index 28d091b..ea90f3b 100644
--- a/src/main/resources/js/files.js
+++ b/src/main/resources/js/files.js
@@ -15,7 +15,6 @@ drop.addEventListener('dragleave', () =>
);
drop.addEventListener('drop', e => {
- // TODO: Fix directory uploading
e.stopPropagation();
e.preventDefault();
drop.style.background = "white";
@@ -38,9 +37,16 @@ drop.addEventListener('drop', e => {
setListeners();
- formData.append("file", file);
- request.open("POST", "/upload/" + path);
- request.send(formData);
+ const reader = new FileReader();
+ reader.onload = () => {
+ formData.append("file", file);
+ request.open("POST", "/upload/" + path);
+ request.send(formData);
+ };
+ reader.onerror = () => {
+ // TODO: Add uploading of directories
+ };
+ reader.readAsText(file)
}
function bytesToSize(bytes) {