0

I'm trying to create a multiple uploads with ZF2. I would set the min and max attribute on the input file. I tried in every way but ZF2 ignores these 2 attributes for the input file.

How can I do?

namespace Admin\Form;

use Zend\Form\Form;

class Image extends Form
{
    public function __construct()
    {
        parent::__construct('image');

        $this->setAttribute('method', 'post');

        $this->add(array(
            'name' => 'image',
            'type' => 'Zend\Form\Element\File',
            'attributes' => array(
                'multiple' => true,
                'accept' => '.jpg,.png',
                'id' => 'image',
                'min' => 1,
                'max' => 5,
            )
        ));

        $this->add(array(
            'name' => 'submit',
            'attributes' => array(
                'type' => 'submit',
                'value' => 'save',
                'id' => 'submitbutton',
                'class' => 'btn btn-success'
            )
        ));
    }
}

0 Answers0