コード例 #1
0
 public function createAction()
 {
     parent::postDispatch();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->redirect('/auth');
     }
     $dbTable = new Application_Model_DbTable_Block();
     $adapter = new Zend_File_Transfer_Adapter_Http();
     $options = array('ignoreNoFile' => true);
     $adapter->setOptions($options);
     $info = $adapter->getFileInfo();
     // Redireciona para home depois do submit
     if (isset($_POST['submit'])) {
         //Envia para a tabela um novo bloco criada.
         $adapter->setDestination('c:/teste');
         $link_file = $adapter->getFileName();
         $name_file = $adapter->getFileName(null, false);
         $text = $_POST['text'];
         $author = $_POST['author'];
         $type = $_POST['type'];
         $dbTable->insert(array('date' => date('Y-m-d H:i:s'), 'text' => "{$text}", 'type' => "{$type}"));
         $adapter->receive();
         header('Location: ../');
     }
 }