Here is a demonstration of the issue:
HTML
<form data-request="onSubmit" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileUpload" id="fileUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
PHP
function onSubmit()
{
echo $_FILES["fileUpload"]["name"];
}
This code always outputs
"Undefined index: fileUpload"
Which clearly means that PHP isn't able to access the data since the index that should contain a file is undefined. How would I be able to pass a file input by the client into PHP?
Solutions can use javascript with jQuery if necessary.
P.S. I already tried the solution here. It did not work.