我有一個簡單的表單,它有上傳的電子郵件和文件,它顯示正確,提交後它轉到我設置的結果頁面,正確。 但是,我無法在服務器上找到現在的文件。如何在Zend中實現文件上傳?
這裏是我的代碼:
形式:
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setName('form-counting');
$email = new Zend_Form_Element_Text('email');
$email -> setLabel('Name:')
->addFilter('StripTags')
->addValidator('NotEmpty', true)
->addValidator('EmailAddress')
->setRequired(true);
$this->addElement($email);
$UP_file = new Zend_Form_Element_File('UP_file');
$UP_file->setLabel('Upload files:')
->setRequired(true)
$this->addElement($UP_file);
$this->addElement('submit', 'submit', array(
'label' => 'GO',
'ignore' => true
));
}
我到底做錯了什麼?由於
凡在bootstrap.php中? – Liza
如果你喜歡 –
是的,它是爲Zend 1.12,請打開你的錯誤報告,並確保你有一個公共文件夾中的文件目錄,或者你正在給的任何路徑存在。 –