To upload multiple files using zend form you have to use file element that zend framework provides,You have to include some extra attributes in this element as ‘multiple’.
Here is code to upload single file and multiple files
Single file upload code

     $this->add(array(
‘name’ => ‘image’,
‘type’ => ‘File’,
‘attributes’ => array(
‘id’ => ‘image’,
‘onchange’ => ‘readURL(this);’,
‘accept’ => ‘image/*’,
),
‘options’ => array(
‘label’ => ‘Image:’,
),
));

Here is code that is used to upload multiple file. Mean you can select multiple files for upload to servcer

       $this->add(array(
‘name’ => ‘image’,
‘type’ => ‘File’,
‘attributes’ => array(
‘id’ => ‘image’,
‘multiple’ => ‘multiple’,
‘onchange’ => ‘readURL(this);’,
‘accept’ => ‘image/*’,
),
‘options’ => array(
‘label’ => ‘Image:’,
),
));

Keyword multiple is most important for multiple files to be uploaded in zend framework.

Leave a Reply

Your email address will not be published. Required fields are marked *