how to create a array element in form – zend framework 2

I want to create the following element :

<input type="file" name="file[]">

I have tried the following code in myproject/module/Member/src/Member/Form/EditForm.php :

$this->add(array(
            'name' => 'file',
            'type'  => 'file',
            'attributes' => array(                
                'class' => 'form-control col-md-7 col-xs-12',                
                'id' => 'file',                
            ),'options' => array(
                'multiple'=>TRUE
            ),
        ));

and

$this->add(array(
            'name' => 'file[]',
            'type'  => 'file',
            'attributes' => array(                
                'class' => 'form-control col-md-7 col-xs-12',                
                'id' => 'file',                
            ),'options' => array(
                'multiple'=>TRUE
            ),
        ));

but it is not working.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s