Add file upload
This commit is contained in:
parent
aa493a0b51
commit
74eef045d8
@ -544,6 +544,7 @@ function uploadFile() {
|
|||||||
const file = fileInput.files[0];
|
const file = fileInput.files[0];
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('userfile', file);
|
formData.append('userfile', file);
|
||||||
|
formData.append('action', 'uploadFiles');
|
||||||
|
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', '/upload', true);
|
xhr.open('POST', '/upload', true);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<page minimal_permission_level="2" secret="yes" page_title="Súbory"></page>
|
<page minimal_permission_level="2" secret="yes" page_title="Súbory"></page>
|
||||||
<form id="uploadForm" enctype="multipart/form-data" method="POST">
|
<form id="uploadForm" enctype="multipart/form-data" method="POST">
|
||||||
<label for="fileInput">Send this file: </label>
|
<label for="fileInput">Send this file: </label>
|
||||||
<input type="hidden" name="action" value="uploadFiles">
|
|
||||||
<input name="userfile" type="file" id="fileInput" />
|
<input name="userfile" type="file" id="fileInput" />
|
||||||
<input type="button" value="Send File" onclick="uploadFile()" />
|
<input type="button" value="Send File" onclick="uploadFile()" />
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user