aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/js
diff options
context:
space:
mode:
authorMarvin Borner2019-04-17 01:30:39 +0200
committerMarvin Borner2019-04-17 01:30:39 +0200
commitb8e81e52f4e12186455b6d17b378f29383d7ce88 (patch)
tree585fe42fc6966d5f3f74decf6af5b25ee40bc83a /src/main/resources/js
parent1b790423c46498b96ad2cd0671114226c9941f9f (diff)
Added directory uploading template
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/main/resources/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) {