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 ?

Kevin
  • 11,521
  • 22
  • 81
  • 103

2 Answers2

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?

Community
  • 1
  • 1
jeremyharris
  • 7,884
  • 22
  • 31
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/

Karthik Kamalakannan
  • 770
  • 1
  • 11
  • 31
kongaraju
  • 9,344
  • 11
  • 55
  • 78