This could be a limitation of the environment but what I am trying to do is drop a file then have it post a file direct to the server PHP (no Ajax)... but the $_FILES variable is not correctly populated... Method: as the drop occurs the file object is taken and appended to a form which is submitted... This is normally done using and append to Ajax, but this creates an extra process that I don't want or need...
function uploadFile(e) {
file_obj = e.dataTransfer.files[0];
uploadForm = document.getElementById("upload_form");
// Add the input to the form
uploadForm.append('file', file_obj);
// Add the form to dom
document.body.appendChild(uploadForm);
// Just submit
uploadForm.submit();
}
<form action="upload.php" id="upload_form" enctype="multipart/form-data" method="post">
<div id="drop_file_zone" ondrop="uploadFile(event)" ondragover="return false">
<p>Drop file here</p>
<input name="" type="submit">
</div>
</form>