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

John Gregg johnnyg at google.com
Wed Apr 28 11:03:29 PDT 2010


>> Also, I do believe the ability to upload a whole directory is important for
>> some good use-cases, e.g. upload a directory of photos to a photo site while
>> maintaing directory structure.
>
> I can't really say that I can think of any very urgent use cases for
> this. However only a minor tweak to specs would cover this. By
> allowing the filename to contain a partial path you'd have this
> covered without need for new input types. I think this has been
> discussed before.
>

Yes, the path information can be stored and communicated with a small
tweak, let's take that as settled.

Assuming the use case is valid to upload an entire directory while
maintaining directory structure, how should the user choose the
directory?  That's the point I'm interested in settling and I think
we've mostly just circled around it.

Suggestions include:
- Open up a system folder-picker dialog.  The UA needs to know when to
open that dialog instead of a file-picker dialog, the two dialogs
being different on all major platforms, and so we could:
    - use a new 'directory' attribute on <input> to indicate it (my
original proposal)
    - use multiple buttons (add file(s)/add folder/remove) with each
<input multiple> that allows the user to do different things
- Create a new file-picker for <input multiple> that allows both file
and folder selection (i think most people want to avoid this)
- Ojan's proposal: allow a folder to be dragged onto a <input
multiple> tag, but don't allow specifying through dialogs.

Clearly there are options without the new attribute, but I still think
they all result in awkward UI.  I don't think allowing drag and drop
only would be sufficient especially considering accessibility.

 -John



More information about the whatwg mailing list