Add file upload

This commit is contained in:
Bruno Rybársky 2024-04-25 10:20:32 +02:00
parent 2f49e6aa8a
commit aa493a0b51
2 changed files with 2 additions and 2 deletions

@ -546,7 +546,7 @@ function uploadFile() {
formData.append('userfile', file); formData.append('userfile', file);
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open('POST', '__URL__', true); xhr.open('POST', '/upload', true);
xhr.onload = function () { xhr.onload = function () {
if (xhr.status === 200) { if (xhr.status === 200) {

@ -1,5 +1,5 @@
<!--suppress HtmlUnknownTag, HtmlUnknownTag --> <!--suppress HtmlUnknownTag, HtmlUnknownTag -->
<page minimal_permission_level="2" secret="yes" page_title="Súbory" action="/upload"></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 type="hidden" name="action" value="uploadFiles">