[whatwg] File Upload Control

Malcolm Rowe malcolm-what at farside.org.uk
Thu Jul 22 00:37:02 PDT 2004

Smith, Rolland wrote:
  > What my suggestion/request is, is that the file upload control be fully
> customizable by CSS just as the regular form textboxes are. Furthermore 
> if there was a way to style the button and the textbox separately that 
> would be an extreme help, as well as making the browse button an IMAGE 
> instead of the standard text display button with a gray background and 
> just "Browse" on it.

Note that, technically, CSS doesn't define how form controls should be 
styled at all; a future specification from the CSS working group is 
expected to cover that hole. In practice, however, many of the CSS 
styles work as you might expect, but not necessarily interoperably 
between browsers.

Additionally, note that HTML does not proscribe any rendering for <input 
type=file> controls, and so there's no way to guarantee that the UA 
provides a 'Browse' button coupled with an input box. Again, in 
practice, many (not all) do exactly that.

These two things, in addition to the security issue that David mentioned 
earlier, mean that it's unlikely that we'll see the ability to style 
file upload controls in any meaningful cross-browser fashion any time soon.

> [...] in the new spec you'd be able to specify a Number of 
> files to upload per file upload control. Does this mean that for 
> whatever number is entered (say 3) that we'd see 3 textboxes/browse 
> buttons for 3 file uploads

You can specify 'min' and 'max' numbers of files for the control; these 
default to '0' and '1' respectively, making the default behaviour the 
same as the current behaviour. Just like the HTML spec, the WF2 spec 
doesn't mandate any kind of visual appearance for the upload controls, 
though I'd think it'd be pretty strange for a UA to replicate the 
control in the way you're suggesting.

It's more likely that a visual UA would present a control similar to the 
currently-provided one, and just permit multiple files to be entered in 
the text box/selected from the dialog box. But that is up to the UA.

 > [...] and that each of those must be (validation
 > built-in?) filled out with a proper file path to an existing file?

The default is for the 'min' attribute to be zero, making the control 
optional, so no, allowing up to three files to be uploaded does not 
require that number of files to be uploaded.

>     * Make the file upload control fully customizable by CSS as the
>       regular textboxes are

They are, per spec, since text boxes aren't stylable :)  But no, this 
seems unlikely, if for no other reason than security.

>     * Possibly allow the textbox and Browse button to be treated
>       separately maintaining GLOBAL or individual properties with
>       regards to regular HTML type properties and CSS properties.

I don't quite understand what this means, but it seems to hinge on the 
assumption that we always have a 'textbox-and-button' control, which is 

>     * Allow upload of more than one file per upload control, but do not
>       force the number of files specified to be required and instead
>       offer a validation option that would either force this or allow it
>       to be any number of files within the specified range (i.e.: 4 is
>       specified; allow 1 to 4 files; not requiring a minimum of 4)

<input type=file min=1 max=4>
<input type=file min=0 max=4> or <input type=file max=4>
if you want to make it completely optional.

> Picture (Metafile)

By the way, your email was about 72Kb in size, and only 7% of that was 
'important' - the rest was taken up by this image and a duplicate of 
your message. Please don't do that again.


More information about the whatwg mailing list