/** * Example of a single File element using the HTML5 "multiple" attribute. * * @return array|ViewModel */ public function collectionAction() { $form = new Form\CollectionUpload('file-form'); if ($this->getRequest()->isPost()) { // Postback $data = array_merge($this->getRequest()->getPost()->toArray(), $this->getRequest()->getFiles()->toArray()); $form->setData($data); if ($form->isValid()) { // Get raw file data array //for ($i=0; $i < $form->numFileElements; $i++) { // $fileData = $form->get('file-collection')->get($i)->getValue(); // Debug::dump($fileData); //} //die(); // // ...Save the form... // return $this->redirectToSuccessPage($form->getData()); } } return array('form' => $form); }
/** * Example of a single File element using the HTML5 "multiple" attribute. * * @return array|ViewModel */ public function collectionAction() { $form = new Form\CollectionUpload('file-form'); if ($this->getRequest()->isPost()) { // Postback $data = array_merge_recursive($this->getRequest()->getPost()->toArray(), $this->getRequest()->getFiles()->toArray()); $form->setData($data); if ($form->isValid()) { // // ...Save the form... // return $this->redirectToSuccessPage($form->getData()); } } return array('form' => $form); }