0
以下Zend框架的形式无法正常工作:Zend_Form_Element_File不工作
<?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
。我该如何解决这个问题?谢谢
'data'文件夹是否确实位于服务器的根目录下,还是位于您的应用程序目录中?我想你可能会指定错误的路径。试试'APPLICATION_PATH。 '/ data/uploads''来代替。 – drew010 2012-07-23 04:50:43