/** * Example of AJAX File Upload with Session Progress. * * @return array|ViewModel */ public function sessionAction() { $form = new Form\ProgressUpload('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 $fileData = $form->get('file')->getValue(); Debug::dump($fileData); die; } } return array('form' => $form); }
/** * Example of AJAX File Upload with Session Progress. * * @return array|ViewModel */ public function sessionAction() { $form = new Form\ProgressUpload('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... // Debug::dump($form->getData()); die; } else { Debug::dump($form->getMessages()); } } return array('form' => $form); }