コード例 #1
0
 public function addDocumentAction()
 {
     parent::postDispatch();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->redirect('/auth');
     }
     $adapter = new Zend_File_Transfer_Adapter_Http();
     $dbTable = new Application_Model_DbTable_Block();
     $lastText = $dbTable->getTextById($_GET['id']);
     $this->view->block = $lastText;
     if (isset($_POST['submit'])) {
         // Enviar a atualização para o banco.
         $adapter->setDestination('c:/teste');
         $link_file = $adapter->getFileName();
         $name_file = $adapter->getFileName(null, false);
         $dbTable->update(array('date' => date('Y-m-d H:i:s'), 'name_document' => "{$name_file}", 'link_document' => "{$link_file}"), array('id = ? ' => $_GET['id']));
         $adapter->receive();
         header('Location: ../');
     }
 }