2

我已经尝试了所有我能想到的东西,但我不知道如何只ViewHelperZend_Form_Element_File.

$UserPhoto = new Zend_Form_Element_File('UserPhoto');
$UserPhoto->setDestination(TMP_DIR);
$UserPhoto->addValidator('Count', false, 1);
$UserPhoto->addValidator('Size', false, 10240000); // 10 mb max
$this->addElement($UserPhoto);

在我看来脚本:

echo $this->form->UserPhoto

产生

<dt>label</dt>
<dd>input element</dd>

这就是我要的:

input element
4

2 回答 2

2

这是我可以让它工作的唯一方法:

$this->addElement($UserPhoto, 'UserPhoto');
$this->UserPhoto->removeDecorator('label');
$this->UserPhoto->removeDecorator('htmlTag'); //DtDd
于 2010-08-05T19:30:56.420 回答
2

最短的形式是:

$UserPhoto->setDecorators(array('File'))
于 2010-08-05T21:40:27.063 回答