Add file upload

This commit is contained in:
Bruno Rybársky 2024-04-25 10:21:53 +02:00
parent aa493a0b51
commit 74eef045d8
2 changed files with 1 additions and 1 deletions

@ -544,6 +544,7 @@ function uploadFile() {
const file = fileInput.files[0];
let formData = new FormData();
formData.append('userfile', file);
formData.append('action', 'uploadFiles');
let xhr = new XMLHttpRequest();
xhr.open('POST', '/upload', true);

@ -2,7 +2,6 @@
<page minimal_permission_level="2" secret="yes" page_title="Súbory"></page>
<form id="uploadForm" enctype="multipart/form-data" method="POST">
<label for="fileInput">Send this file: </label>
<input type="hidden" name="action" value="uploadFiles">
<input name="userfile" type="file" id="fileInput" />
<input type="button" value="Send File" onclick="uploadFile()" />
</form>