File Upload

Caution:
When using this feature, please check php timeout and max filesize settings on your webserver. Furthermore, your server must have a temporary upload directory.

Add Field

// File example
$form->addField('Your Document', 	'file', 	array(
		'multiple' => true,
		'types'   	=> ['jpg', 'png'])
);

Attributes

You can customize the field with one of these optional parameters:

Parameter Type Default Info
required boolean true Validation will return false when the field is left empty
classlist string has-error will be added to classes if validation returns false.
is-valid will be added if the validation was successful.
Add classes to input field and its field wrap e.g. column-with classes of a grid system.
label string Label for input field
multiple boolean false Allow upload of multiple files at once.
limit_search boolean true Only show accepted file types in file explorer/finder.
maxsize double 16 Max file size in megabytes. Please make sure your webserver configuration allows the defined file size.
maxfiles int 10 Max number of files that can be uploaded.
types array
['jpg', 'png', 'gif', 'txt', 'pdf', 'zip', 'tar']
Array with allowed file types. You can define a limited array with some of the default file types.
For security reasons, the upload feature is limited to a few file types.