I have this as HTML:
<input type="file" id="foo" multiple/>
This javascript:
$("#foo").change(function(){
var files = $(this)[0].files;
$.ajax({
// ???
});
});
This PHP (upload.php):
if (!empty($_FILES)) {
// Upload code
Currently the files are being read correctly from the input box.
I want to use these files inside the upload.php. I have a different dropzone on my page which uses this upload.php. I don't want to write unneccesary double code so I would like to use this file again. However, I cannot send an ajax request with $_FILES.
TL;DR: How can I send an array with files with ajax to a PHP Url and use it there with $_FILES ?
Notes:
+ My input is not in a < form >
+ It is possible to select multiple files, so I need to pass multiple files to the php file
Thanks in advance!