It provides an input field for files.

When using the file input type, you should always add the attribute enctype="multipart/form-data" to your form tag. Otherwise, the uploaded files will not be attached correctly.

Example XML field definition:

<field name="myfilevalue"
type="file"
label="Enter some text"
description="Choose an image with maximum 100KB"
size="10"
accept="image/*" />

Parameters

Mandatory Parameters

  • type must be file.
  • name is the unique name of the field.
  • label (translatable) is the descriptive title of the field.

Optional Parameters

  • description (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • default is the default value, but doesn't mean much for a file.
  • size is the width of the file box in characters.
  • accept: Tells the browser what MIME types your form will allow to be uploaded.
  • class is a CSS class name for the HTML form field.
  • labelclass adds a CSS class for form field's label
  • disabled: HTML equivalent attribute
  • onchange: HTML equivalent attribute (javascript use)
  • required: Cannot be used with this field type. If the field is marked as required it will always fail validation regardless of whether a file has been uploaded or not. The suggested workaround is to add a filerequired attribute which can be tested in your own file handling code.
  • validate: Whether to Joomla validate the field according to rules
  • showon: Allows you to hide the field based on the values of another field
  • multiple: Allows you to upload multiple files at once when set to multiple="true"