HTML Object error
Posted: Mon May 15, 2023 8:04 pm
I have a simple form with an html object that retrieves a file.
This code works perfectly when the form is opened from the magnifing glass in the form builder module. However when opening it from a launch menu button I get this error
Code: Select all
<!-- HTML5 Input Form Elements -->
<p>Click on the "Choose File" button to upload a file:</p>
<input id="fileupload" type="file" name="fileupload">
<button id="upload-button" onclick="uploadFile()"> Upload </button>
<!-- Ajax JavaScript File Upload Logic -->
<script>
async function uploadFile() {
let formData = new FormData();
formData.append("file", fileupload.files[0]);
await fetch('libs/upload/upload1.php', {
method: "POST",
body: formData
});
alert('The file has been uploaded successfully.');
}
</script>