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

John Gregg johnnyg at google.com
Thu Apr 1 15:53:08 PDT 2010

For context, Ian Fette started a thread about uploading directories of files
in December:

At that time, it was thought that directory upload could be implemented by a
UA in response to a <input type="file" multiple> tag using different UI
only, and modifying the FileAPI spec to allow path information in the form


I've started developing a prototype of this in WebKit/Chromium.  Based on
what I've encountered so far, I would like to propose adding directory
upload functionality using an explicit new 'directory' attribute on the file
input element.

The existing behavior of <input type="file" multiple> would not change, but
when processing <input type="file" directory>, the UA would display a
directory selection UI and store the path information, and *not* allow
individual files to be selected.  It would allow multiple files to have the
same leaf name (.name attribute), as long as the paths were different.  The
path attributes would include the name of the chosen directory

This would be preferable for several reasons:
 - Most built-in file system UI on major platforms (Windows/Mac/Linux) have
distinct dialogs for choosing files and choosing directories.  Allowing the
UA to use these directly makes sense rather than creating hybrids.
 - Avoiding "leaf name" conflicts in a directory tree is not feasible in
many applications -- asking a user to ensure unique photo names in a large
set of albums before uploading would fail to meet that use case.  Therefore
HTML documents should know in advance whether the path information will be
relevant in the eventual storage of the files.  Sites currently using <input
type="file" multiple> would have compatibility problems with an
implementation which allowed conflicting file names along different paths.

What are your thoughts about adding the 'directory' attribute?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100401/789655d4/attachment.htm>

More information about the whatwg mailing list