W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

Re: [whatwg] Make files attribute of the input element writable

From: Nico Weber <thakis@chromium.org>
Date: Wed, 23 May 2012 19:11:46 -0700
Message-ID: <CAMGbLiEzv5h1tsXpzE6vuTo=k8ALAP7hGWArYnN-eiUCmTa-cA@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: whatwg@whatwg.org, Jonas Sicking <jonas@sicking.cc>
On Wed, May 23, 2012 at 7:01 PM, Ojan Vafai <ojan@chromium.org> wrote:
> On Tue, May 22, 2012 at 6:38 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>> I don't think simply marking the attribute as writable is the correct
>> solution here. At the very least we should make it possible to assign
>> a sequence<File> to the attribute such that you can do:
>>
>> myInput.files = [file1];
>>
>> But even a sequence<Blob> should be allowed IMO.
>
> Makes sense to me. Can we just kill FileList and always use File[] (or
> "readonly File[]" for the readonly cases)? The only cases where this is used
> in the HTML spec are file inputs and dataTransfer. We should make setting a
> non-readonly T[] to a sequence<T> work across the platform IMO.
>
> Allowing setting a sequence<Blob> could be made to transparently work as a
> followup, no? You should be able to just set myInput.files = myBlobSequence.
> As Anne points out, it's unclear what the UI for this would be.

Is the UI for an array of Files much clearer? With a FileList, the
selected files were at some point selected by the user from a file
explorer, so it's fairly likely that an input file picker knows how to
display them. For a general File[] array, the files might be scattered
in multiple directories. (And the step from writable FileList to
File[] array could be done in a transparent follow-up too.)

Nico
Received on Thursday, 24 May 2012 02:12:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:08 GMT