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

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