Zend framework Zend_表单_元素_文件不工作
以下Zend Framework表单工作不正常:Zend framework Zend_表单_元素_文件不工作,zend-framework,zend-form,zend-form-element,Zend Framework,Zend Form,Zend Form Element,以下Zend Framework表单工作不正常: <?php class Application_Form_Auth extends Zend_Form { public function init() { $this->setAttrib('enctype', 'multipart/form-data'); $this->setMethod('post'); $username = $this->
<?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;
}
}
?>
当我从代码中删除这一行时,表单工作正常。我在
/data/uploads
中有上载文件夹,并将目录的权限设置为777
。我怎样才能解决这个问题?谢谢您是否使用任何域(没有本地主机)。如果是,则应使用数据/上传。数据目录应位于公共目录中。如果您有任何域,则应将目标路径与baseUrl一起使用 data
文件夹是否真的位于服务器的根目录下,还是位于您的应用程序目录中?我认为您可能指定了错误的路径。请尝试应用程序路径/数据/上传'。
->setDestination('/data/uploads')