Commit fd5b06da authored by Lukas Böhm's avatar Lukas Böhm
Browse files

Update Upload.html

parent 4f66669f
......@@ -61,7 +61,7 @@
$(".custom-file-input").on("change", function() {
let fns = $(this)[0].files;
let label = "";
for (var i = 0; i < fns.length; i++) {
for (let i = 0; i < fns.length; i++) {
label = label.concat(fns[i].name);
if (i < fns.length - 1) label = label.concat(", ");
}
......@@ -69,7 +69,7 @@
});
</script>
<script>
let share = {}
let share = {};
function openShare() {
$.ajax({
......@@ -83,11 +83,19 @@
}).done((response) => {
share = response;
disableAll();
uploadFile();
uploadFiles();
});
}
function uploadFile() {
function uploadFiles() {
for (file in $(".custom-file-input")[0].files) {
var formData = new FormData();
var request = new XMLHttpRequest();
formData.set('files', file);
request.open("POST", `http://localhost:6969/share/${ share.id }/attachments`);
request.send(formData);
}
closeShare();
}
......@@ -100,8 +108,9 @@
"Content-Type": "application/json"
},
"data": JSON.stringify({}),
}).done(() => {
window.location.href = "/d/" + share.id
}).done((response) => {
console.log(response);
{#window.location.href = "/d/" + share.id;#}
});
}
</script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment