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

Michael A. Puls II shadow2531 at gmail.com
Sun Jun 22 15:21:13 PDT 2008


On 6/22/08, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> Michael A. Puls II wrote:
>
> > Anyway, the use case for .value is:
> >
> > ...
> >        <p>File to attach: <p>
> >        <p><input type="file"
> > onchange="document.getElementsByTagName('p')[0].innerHTML
> +=
> > this.value;"></p>
> > ...
> >
>
>  How is that a use case?  Please explain why outputting the value of the
> control in an adjacent paragraph is useful at all and why authors would do
> it.  The value is visible in the control itself, so that seems unnecessary.

The file is visible in the control itself, but:

If the control is not long enough, you might not see the filename
unless you scroll in the field or the script resizes based on a
multiple of the length of .value. Even then, the path might be
considered noise.

An author might provide the filenames in a more friendly and readable way.

As another example, imagine you have <input type="file"> and onchange,
it adds a filename to a SELECT element and resizes the element.

Then, the select has an onchange listener itself. When you select a
different file in the SELECT, you can make something happen.

For example, you can browse to .wav files and add them to a select
playlist. Then, you can select each of the filenames to have them play
with Audio() for example. Attached is a super basic example of that.

Instead of Audio(), you might load theora videos and play them with
the VideoLan plugin or load wmv files and play them with WMP.

-- 
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080622/fb258fe1/attachment-0001.html>


More information about the whatwg mailing list