O'Reilly logo

Zend Framework 2.0 by Example Beginner's Guide by Krishna Shasankar V

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – HTML5 multiple file uploads

Perform the following steps for HTML5 multiple file uploads:

  1. Create a new ImageUpload form; make sure that the multiple attribute for the File element is set to TRUE:
    <?php
    // filename : module/Users/src/Users/Form/MultiImageUploadForm.php
    namespace Users\Form;
    
    use Zend\Form\Form;
    use Zend\Form\Element;
    use Zend\InputFilter;
    
    class MultiImageUploadForm extends Form
    {
        public function __construct($name = null, $options = array())
        {
            parent::__construct($name, $options);
            $this->addElements();
            $this->addInputFilter();
        }
        
        public function addElements() 
        {
          $imageupload = new Element\File('imageupload');
          $imageupload->setLabel('Image Upload')
            ->setAttribute('id', 'imageupload')
     ->setAttribute('multiple', true); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required