[whatwg] Forms: <input type=file> and directory tree picking

Ian Hickson ian at hixie.ch
Thu Aug 29 14:45:04 PDT 2013

On Thu, 29 Aug 2013, Jonas Sicking wrote:
> On Thu, Aug 29, 2013 at 1:20 PM, Ian Hickson <ian at hixie.ch> wrote:
> > On Fri, 2 Aug 2013, Jonathan Watt wrote:
> >>
> >> I'm working on Mozilla's implementation of <input type=file> to allow 
> >> the user to pick a directory. The idea would be that the files in 
> >> that directory and its subdirectories would be added to the 
> >> HTMLInputElement.files FileList.
> >
> > This seems to be dangerous in that it makes it really easy for the 
> > user to select a single item that expands into tens of thousands if 
> > not millions of files on a remote disk, which then all have to be 
> > synchronously enumerated to get the count so that code can then itself 
> > enumerate through the entire list.
> We don't have to do any enumeration synchronously. It can all happen off 
> the main thread. The .click() "API" is asynchronous.

It's asynchronous to the JS, sure, but at the end of the day the user 
can't get any work done until it's complete. It's synchronous as far as 
the user is concerned.

> > So you wouldn't be able to pick a file and a directory as in the 
> > example above? That seems unfortunate...
> Unfortunately most OSs doesn't have support for filepickers that can 
> select either a file or a directory.

True. From a UI perspective it's kind of weird that the user has to decide 
which he wants, though. Similarly, from an authoring perspective, I don't 
understand how I would decide whether to show a multiple file picker or a 
directory picker.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list