[whatwg] Directory upload via <input type="file" directory>

J Ross Nicoll jrn at jrn.me.uk
Sat Apr 24 01:47:07 PDT 2010


The API doesn't officially seem to cover dragging and dropping directories.

The implementation in Firefox is to allow directories to be dropped into 
the browser along with files. It passes them to the script with an empty 
type attribute, and attempts to read them produce a directory listing. 
However, I don't believe this gives the script the ability to read the 
files within a dropped directory (it knows where they are, but is 
constrained by the sandbox).

I would suggest this is something the drag & drop API needs to be 
expanded to cover explicitly; perhaps have "isDirectory" and "files" 
attributes on the File object, to indicate that a file reference is 
actually a directory, and to access the contents of that directory 
respectively.

Anne van Kesteren wrote:
> On Fri, 23 Apr 2010 07:11:08 +0900, Ojan Vafai <ojan at chromium.org> wrote:
>> But there is already a default UI that lets you select a folder, a 
>> file or both (drag-drop). I don't see why this forces the UA to do 
>> anything. Just
>> because you can select both folders and files doesn't mean the UA 
>> needs to expose extra UI on top of drag-drop to let you do so. Again, 
>> no more so than they already have to expose extra UI to deal with 
>> multiple inputs.
> 
> How does the drag & drop API support this use case?
> 
> 




More information about the whatwg mailing list