以下 Zend Framework 表单无法正常工作:
<?php
class Application_Form_Auth extends Zend_Form
{
public function init()
{
$this->setAttrib('enctype', 'multipart/form-data');
$this->setMethod('post');
$username = $this->createElement('text','username');
$username->setLabel('Username:')
->setAttrib('size',10);
$password = $this->createElement('password','password');
$password->setLabel('Password')
->setAttrib('size',10);
$file = new Zend_Form_Element_File('file');
$file->setLabel('File')
->setDestination('/data/uploads')
->setRequired(true);
$reg = $this->createElement('submit','submit');
$reg->setLabel('save');
$this->addElements(array(
$username,
$password,
$file,
$reg
));
return $this;
}
}
?>
问题在于:
->setDestination('/data/uploads')
当我从代码中删除这一行时,表单工作正常。我有上传文件夹,并为该目录/data/uploads
设置了权限。777
我该如何解决这个问题?谢谢