[whatwg] Directory upload via <input type="file" directory>
den.molib at gmail.com
Sat Apr 24 06:50:59 PDT 2010
John Gregg wrote:
> The use case is not about choosing a directory for some browser
> functionality, it is really about choosing a directory that you want
> to upload to a web page, such as a collection of photo albums.
> >From Ian Fette's original email
> USE CASE:
> Many sites allow you to upload multiple files, often images. HTML5 allows
> this via <input type="file" multiple>. This works well when your files are
> all in one folder, but it may often be the case that files are spread across
> sub-folders, and in this case you have to do multiple transactions (or
> multiple <input type=file multiple> tags, which is just awkward) to upload
> your files.
I fail to see how a new input variant fixes that.
I foresee the <input type=file multiple> as a box with buttons Add and
The Add button would be enabled iif the element is mutable.
The Remove button would be enabled iif the element is mutable and there are
elements selected inside.
When you press Add file, the file picker dialog opens, and you can
choose a single
file or several files.
If you want to also include files from a different folder, you press
again Add and
continue adding files. You could even add them one at a time (that's
what I think
people will do the first time they see it).
You keep track of what you have added on the box, where items are shown.
can remove items from there with the other button.
The User-Agent MAY provide a different button to recursively add a
a different dialog than the OS default to provide that recursively-add
a contextual menu in the folder shown, dropping the folder, keyboard
The web page doesn't know if the user has all the files he wants to add
exactly one directory tree. Thus it would be able to determine if it
should set the
directory attribute or not. The user can tell the UA that it's the case
if it provides
a different option for doing that on input multiple file.
As a sidenote, the dialogs allowing either files or folders that I have
dealed with are
usually confusing, often performing the opposite action than the one I
wanted them to
perform that time. This doesn't mean that they can't be done, just that
they are hard
to do *well*. I'd try to avoid going that route if possible.
More information about the whatwg