W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

[whatwg] Uploading directories of files

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 10 Dec 2009 21:29:51 -0800
Message-ID: <63df84f0912102129h5a5c377qcbe632eaa3c8f1a3@mail.gmail.com>
2009/12/10 Ian Fette (????????) <ifette at google.com>:
> 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.
> PROPOSAL: Allow a UA to recursively select and upload a directory of files.
> How the UA chooses to modify the file picker dialog is outside the scope of
> this spec, but for the sake of argument, assume that the UA lets you pick a
> folder and say "upload all". Allow the UA to upload the files in the folder,
> with the subdirectories included in the filename with a directory separator.
> E.g. assume I have:
> C:\users\ian\a\b\1.jpg
> C:\users\ian\a\b\2.jpg
> C:\users\ian\a\c\3.jpg
> If the user chooses "a", the UA should be allowed to send all three files
> with filenames:
> "a/b/1.jpg"
> "a/b/2.jpg"
> "a/c/3.jpg"
> as it would for the existing <input type=file multiple> implementation, with
> the addition of the directories and path separators (not full path, just the
> directory the user chose and sub-paths.)
> Thoughts?

I don't think there is anything in the spec preventing you from doing
this right now. The fact that only files in the same folder can be
selected is a limitation in the implementation, not a limitation in
the spec.

The spec does require that only the leaf name, without any paths, are
submitted. Is that a problem?

I guess I'd be ok with changing the spec to allow more of the path to
be exposed. However that would mean that there is a mismatch between
what name is submitted and what name you'd get from
input.files[n].name.

/ Jonas
Received on Thursday, 10 December 2009 21:29:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC