2008年10月29日星期三

[fw-mvc] Zend_Form_Element_file

Hi guys,

since I've updated to ZF 1.6.2 I've been having a few problems with
the zend_form_element_file. I've created a simple test to make sure
the problem wasn't in any of my other code:

$form = new Zend_Form();
$form->setAttrib('enctype', 'multipart/form-data');
$form->setAction('/formtest/index');
$element = new Zend_Form_Element_File('image');
$element->setLabel('Image:')
->setRequired(true)
->setDecorators(array(
'ViewHelper',
array( 'Description', array('tag'=>'p','class'=>'note') ),
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' =>
'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
))
->setDestination('/Users/wp/Sites/knz/tmp/uploads/images/')
->addValidator('Count', false, 1)
->addValidator('Size', false, 10485760)
->addValidator('Extension', false, 'jpg,png,gif');
$form->addElement($element, 'image');
$form->addElement('submit', 'submit');

This will give the following error:
Fatal error: Unsupported operand types in
/Users/wp/Sites/library/Zend/File/Transfer/Adapter/Abstract.php on
line 796

When the setDecorators function is removed, the error will disappear
as well. What am I doing wrong?

Thanks for your help!

Regards,
Pieter

没有评论: