From: 2weiEmu Date: Tue, 2 Jun 2026 18:20:33 +0000 (+0200) Subject: updated: file uploading seems to work X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=22d69fa2232225b19156462da354437432385022;p=binbsis50-sm.git updated: file uploading seems to work --- diff --git a/public/index.html b/public/index.html index a7b93f9..97901fa 100644 --- a/public/index.html +++ b/public/index.html @@ -46,6 +46,9 @@

Upload a New File

+ File Upload
+ Name of File Here +
diff --git a/public/js/index.js b/public/js/index.js index 62028c5..0e3d47c 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -386,6 +386,33 @@ async function uploadFileWithLinkAndName() { } } +let fileUploadFileContent = document.getElementById("fileUploadFileContent") +let fileUploadFileName = document.getElementById("fileUploadFileName") +let fileUploadFileUploadButton = document.getElementById("fileUploadFileUploadButton") + +async function uploadFileWithDataAndName() { + + let content = fileUploadFileContent.files[0] // it's a bit quirky like that + let filename = fileUploadFileName.value // TODO: again name checking, also on the server side + + console.log(content) + let response = await fetch("/api/files/createWithUpload/" + filename, { + method: "POST", + body: content + }) + + if (response.status != 200) { + alert("Something went wrong uploading the file... harass admin") + } + else { + fileUploadFileUploadButton.classList = "success" + + await sleep(500) + + fileUploadFileUploadButton.classList = "" + } +} + /** * SETUP / RUN AT START SECTION **/ diff --git a/songmanager b/songmanager index 5f55f20..ade57ed 100755 Binary files a/songmanager and b/songmanager differ diff --git a/testing/songs/Enigma_Sadeness.m4a b/testing/songs/Enigma_Sadeness.m4a deleted file mode 100644 index e69de29..0000000 diff --git a/testing/songs/get_over_you.m4a b/testing/songs/get_over_you.m4a new file mode 100644 index 0000000..8465f88 Binary files /dev/null and b/testing/songs/get_over_you.m4a differ diff --git a/testing/songs/null b/testing/songs/null deleted file mode 100644 index e69de29..0000000