I am working on a drag file upload field.
I can return a FileList object containing the file specified by the user. I have a hidden file input field, which then I want to add a file object to then send form data via AJAX.
The problem that I am facing is that I cannot copy the file object to the file input field. Here is how I am trying to do this:
var files = evt.dataTransfer.files;
var fileUploadElem = document.getElementById(fileUploadId);
fileUploadElem.files[0] = files[0];
console.log('fileUploadElem length: '+fileUploadElem.files.length);
Appreciate any tips or pointers.
source
share