2

I'm trying to implement jQuery-File-Upload - I have it working when I drag & drop files from explorer into my browser. But I also want to be able to drag and drop a folder.

When I drop files onto the browser, the files are in the data.files param in the fileuploaddrop(e, data) event handler. But when I drop a folder, the files array is empty.

var dropZone = $('#fileUploadDiv').fileupload({
    dropZone : $('.dropZone'),
    drop : function(e, data) {
      $.each(data.files, function(index, file) {
        console.log('Dropped file: ' + file.name);
      });
    }
}).

Is this not supported by the plugin, or is there a mystery setting I'm missing somewhere ?

2 Answers 2

5

The uploader uses HTML5 capabilities, which don't allow dropping folders. Read more here: Does HTML5 allow drag-drop upload of folders or a folder tree?

Sign up to request clarification or add additional context in comments.

Comments

2

Drag/Drop and input Directory upload now available with chrome 21

you can get directory upload using webkitdirectory

<input type='file' webkitdirectory>

Here is a complete code for uploading folders.

https://protonet.info/en/blog/html5-experiment-drag-drop-of-folders/

1 Comment

This seems to limit to only directories. Is there any way to select both files and directories?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.