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

Jonas Sicking jonas at sicking.cc
Sun Apr 25 15:42:48 PDT 2010


On Sun, Apr 25, 2010 at 8:42 AM, Ojan Vafai <ojan at chromium.org> wrote:
> On Sat, Apr 24, 2010 at 9:49 AM, Jonas Sicking <jonas at sicking.cc> wrote:
>>
>> On Thu, Apr 22, 2010 at 3:37 PM, John Gregg <johnnyg at google.com> 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.
>>
>> You can do this without any changes to the spec. The fact that chrome
>> only allows files from a single folder to be selected is not a
>> limitation imposed by the spec.
>>
>> In fact, we've talked at mozilla about improving the UI around <input
>> type=file>, and better handling of multiple selected files is high up
>> on that list.
>
> What do you do when there are multiple files with the same name?

I can't think of an application where you'll have to deal with that
anyway. For example for gmail attachments you'd allow uploading
attachments multiple times, in which case there's nothing preventing
the user from selecting different files with the same name.

> 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.

/ Jonas



More information about the whatwg mailing list