I want make a feature like Google drive or other storages. Drop files or folders and upload them. there is my code:
function onDrop(e) {
e.preventDefault();
console.log(e.dataTransfer.items);
var formData = new formData();
for (var i = 0; i < e.dataTransfer.files; i++) {
formData.append('uploads[]', e.dataTransfer.files[i]);
}
//send formData to api
}
So far so good, it upload files well, however, folders doesn't work. I think the solution is getting all files under the folder, and expect will find the directory path information in e.dataTransfer. Unfortunately, I don't get folder data.
It's it possible or should find other way?