I haven't seen any examples that do this. Is this not allowed in the API spec?
I am searching for an easy drag-drop solution for uploading an entire folder tree of photos.
To drag and drop a file or folder, click it with your left mouse button, then, without releasing the button, drag it to the desired location and release the mouse button to drop it. Refer to your Windows help for more information if you haven't used drag and drop.
Upload (using the File Browser)Click the Upload icon. Click Upload Files or Upload Folders, depending on which you'd like to do. Select the file(s) or folder you'd like to upload. Note: You can select multiple files for upload by holding the Command or Control key (Mac or Windows, respectively) while selecting files.
It's now possible, thanks to Chrome >= 21.
function traverseFileTree(item, path) { path = path || ""; if (item.isFile) { // Get file item.file(function(file) { console.log("File:", path + file.name); }); } else if (item.isDirectory) { // Get folder contents var dirReader = item.createReader(); dirReader.readEntries(function(entries) { for (var i=0; i<entries.length; i++) { traverseFileTree(entries[i], path + item.name + "/"); } }); } } dropArea.addEventListener("drop", function(event) { event.preventDefault(); var items = event.dataTransfer.items; for (var i=0; i<items.length; i++) { // webkitGetAsEntry is where the magic happens var item = items[i].webkitGetAsEntry(); if (item) { traverseFileTree(item); } } }, false);
More info: https://protonet.info/blog/html5-experiment-drag-drop-of-folders/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With