University of Melbourne home page
 

File select

The file select field allows users to browse to and upload a file from their computer. The server side permissions and form processing script must be configured correctly for this field to work.

Syntax

The actual field is an input tag of type file. The name attribute is required for the form processing script to label and deal with the uploaded data.

<input name="q7" type="file" />

Sample

To comply with accessibility guidelines, the field must be explicitly and uniquely identified and labeled, and to work with the template style sheets, some spans and classes must be added.

<label for="q7">
  <span class="question">Attach a file...</span>
  <span class="answer"><input name="q7" id="q7" type="file" /></span>
</label>

Example


Validation

To enable validation for this type of field you need to add the required class to the label and a span of class required-flag to the question span.

<label for="q7" class="required">
  <span class="question">Attach a file... <span class="required-flag">(required)</span></span>
  <span class="answer"><input name="q7" id="q7" type="file" /></span>
</label>
 
html/forms/library/file_select.txt · Last modified: 2007/09/11 15:49 by aharris
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki