public function uploadAction() { $translator = \Zend_Registry::get('container')->getService('translator'); // get next redirect param $nextRedirect = new Zend_Session_Namespace('upload-next'); $path = $this->parsePath($this->_getParam('path', '')); $plupload = $this->getHelper('plupload'); $form = new Admin_Form_Upload(); $form->setMethod('post'); $form->getElement('submit')->setLabel($translator->trans('Done uploading', array(), 'themes')); $request = $this->getRequest(); if ($request->isPost() && $form->isValid($request->getPost())) { $files = $plupload->getUploadedFiles(); foreach ($files as $basename => $tmp) { $this->service->storeItem("{$path}/{$basename}", file_get_contents($tmp)); } $this->_helper->flashMessenger($this->formatMessage(array_keys($files), $translator->trans('uploaded', array(), 'themes'))); // redirect by next parameter if (!is_null($nextRedirect->next)) { $this->_helper->redirector->gotoRouteAndExit($nextRedirect->next); } else { $this->_helper->redirector->gotoSimple("index", "themes", "admin"); } } // prelong next parameter $nextRedirect->setExpirationHops(7, 'next', true); $this->view->form = $form; $this->view->path = $this->view->basePath . $path; $this->view->isWritable = $this->service->isWritable($path); }