You can see that we'll be using the Rename Upload filter, along with the Size, Extension and Mime Type validators.Next we add two validators to the object, File\Size and File\Mime Type. It's probably difficult to recall the "thing" that prompts us into crafting the best forms possible, or especially to neophytes, what a clean form might be.
Don't do get Input Filter right inside the form, you'll be thankful when you need your validator down the road (e.g., zf-content-validation, or Apigility). Remember that filters run before validators - that'd been a source of hair loss for me when I was starting out.
The factory's need is arguable if your filter only uses baked in filters/validators.
I think I've had time to distill the outcome; and I'll propose a blanket approach in what follows.
Personally, I'd seen a really clean example in a Git Hub repo and then mentally compared it with what I'd coded....lightbulb! In hindsight, I even documented my struggle along the way.
I needed the translator in here too, the Translator Aware Trait really comes in handy.namespace Application\Form; use Zend\Form\Element; use Zend\Captcha; use Zend\Input Filter; use Zend\Form\Element\Text; use Zend\Form\Form; use Zend\Form\Element\Select; use Zend\Form\Element\Radio; use Zend\Form\Element\Hidden; use Zend\I18n\Translator\Translator Aware Trait; class Tax Form extends Form An aside, the column size stuff that's in there, is there to support a great Twitter Bootstrap form project I like to use. Mosey on over to your module config, and add this to your use statements, and form_elements configuration: So, barring our completion of the Input Factory and Doctrine Entity, the "Form" side of things is done.