W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2010

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

From: Den.Molib <den.molib@gmail.com>
Date: Sat, 24 Apr 2010 15:50:59 +0200
Message-ID: <4BD2F743.9070809@gmail.com>
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.
>
>  -John
>
> >From Ian Fette's original email
> (http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-December/024455.html):
>
> 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
Remove.

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.
You
can remove items from there with the other button.

The User-Agent MAY provide a different button to recursively add a
folder, use
a different dialog than the OS default to provide that recursively-add
behavior,
a contextual menu in the folder shown, dropping the folder, keyboard
trickery, etc.


The web page doesn't know if the user has all the files he wants to add
stored in
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.
Received on Saturday, 24 April 2010 06:50:59 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:22 UTC