View Helpers
In This Article
FormFile
The FormFile
view helper can be used to render an <input type="file">
form
input. It is meant to work with the File element.
Basic usage
use Zend\Form\Element;
$element = new Element\File('my-file');
// Within your view...
echo $this->formFile($element);
// Result: <input type="file" name="my-file">
For HTML5 multiple file uploads, the multiple
attribute can be used. Browsers
that do not support HTML5 will default to a single upload input.
use Zend\Form\Element;
$element = new Element\File('my-file');
$element->setAttribute('multiple', true);
// Within your view...
echo $this->formFile($element);
// Result: <input type="file" name="my-file" multiple="multiple">
Found a mistake or want to contribute to the documentation? Edit this page on GitHub!