W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2008

[whatwg] What should the value attribute be for multi-file upload controls in WF2?

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 24 Jun 2008 01:03:38 -0700
Message-ID: <4860AA5A.70303@sicking.cc>
Adele Peterson wrote:
> Hi all,
> I'm looking at the Web Forms 2 specification for the multi-file upload 
> control that uses the min/max attributes.  When multiple files are 
> selected, its unclear what the value attribute should contain.  It could 
> contain just the first filename, or a comma separated list of all of the 
> filenames.  I think it will be useful though to add something about this 
> in the specification for consistency.

Firefox 3 exposes an API that would let you get all filenames if 
multiple files were selected. The .files property returns a (live) list 
of file objects, each object has the following API:

interface DOMFile
   readonly attribute DOMString fileName;
   readonly attribute unsigned long long fileSize;

   DOMString getAsText(in DOMString encoding);
   DOMString getAsDataURL();
   DOMString getAsBinary();

This of course doesn't answer the question of what to return for .value. 
I would say return the first filename. Trying to encode all filenames in 
a single string is just going to be more complicated than using the 
above API, and returning an array is complicated API wise, and also 
seems more complicated for users than using the above API.

/ Jonas
Received on Tuesday, 24 June 2008 01:03:38 UTC

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