IndexController


~/tmp/ZF/nnext/IndexController.php.html 1 2 <?php 3 class IndexController extends Zend_Controller_Action { 4 static $formData; 5 public function init(){ 6 $this->form = new Form_FileForm(); 7 $polish = PL_Translator::getPolishTranslation(); 8 $trans = new Zend_Translate('array', $polish, 'pl'); 9 $this->form->setTranslator($trans); 10 } 11 function indexAction() { 12 if ($this->_request->isPost()) { 13 // $formData = $this->_request->getPost(); 14 self::$formData = $this->_request->getPost(); 15 16 if ($this->form->isValid(self::$formData)){ 17 return $this->_forward('next'); 18 } else { 19 $this->form->populate(self::$formData); 20 } 21 } 22 $this->view->form = $this->form; 23 } 24 25 function nextAction() { 26 $this->view->dane = self::$formData; 27 $this->view->plik=$_FILES; 28 $this->view->post=$_POST; 29 $this->view->title = "Poprawne"; 30 $upload = new Zend_File_Transfer_Adapter_Http(); 31 $this->view->file = $upload->getFileName(); 32 $this->view->files = $upload->getFileInfo(); 33 34 $upload->addValidator('Size',false, '1MB') 35 ->addValidator('Count', false, 5) 36 ->addValidator('FilesSize', false,'1MB') 37 ->addValidator('Extension',false, 'gif, jpg, png') 38 ->addValidator('ImageSize', false, array(10, 10, 1024, 768)) 39 ->addValidator('NotExists', false, 'temp') 40 ->setDestination('temp'); 41 42 $this->view->dest = $upload->getDestination(); 43 if(!$upload->isValid()){ 44 $this->view->walid ='Nie przeszła'; 45 46 } else { 47 $this->view->walid ='Przeszła'; 48 } 49 $this->view->blad = $upload->getErrors(); 50 $this->view->upload =$upload->isUploaded(); 51 $upload->receive(); 52 $this->view->blad = $upload->getErrors(); 53 54 } 55 }

Wyszukiwarka

Podobne podstrony:
IndexController
java awt image IndexColorModel
indexc052
indexcb67
IndexController 4
IndexController
indexc856

więcej podobnych podstron