ZF-4595: Zend_Form_Element_File blows up when not using filters
Description
Just hooked up 1.6.2 o my existing app and file uploading seems to blow up when using Zend_Form_Element_File.
The error message is:
Notice: Undefined index: filters in /home/colinseaman/ZendFramework-1.6.2/library/Zend/File/Transfer/Adapter/Abstract.php on line 796
Fatal error: Unsupported operand types in /home/colinseaman/ZendFramework-1.6.2/library/Zend/File/Transfer/Adapter/Abstract.php on line 796
Here's my code. I'm not rendering the form using the default Zend_Form layout, instead I'm passing the elements to a view and echo'ing them out one by one. My view script is underneath.
class forms_testForm extends Zend_Form {
public function __construct() {
$uploadPath = Application::instance()->getUploadpaths('profile');
$image1 = new Zend_Form_Element_File('image1');
$image1->setLabel('Upload an image:')
->setRequired(false)
->setDestination($uploadPath)
->addValidator('Count', true, 1) // ensure only 1 file
->addValidator('Size', true, 102400) // limit to 100K
->addValidator('Extension', true, 'jpg,png,gif');
$submit = new Zend_Form_Element_Submit('upload');
$submit->setLabel('Upload');
$this->addElements(array($image1, $submit));
}
}
// View Script
Upload a photo for your profile' <?php echo $this->form->image1 ?> <?php echo $this->form->upload ?>This worked fine with 1.6.1. Have tested this with 1.7PR1 but same error
Comments
Posted by Thomas Weidner (thomas) on 2008-10-14T11:30:01.000+0000
This has already been fixed on trunk. But due to code freeze this fix is not in the Sanity Check Packages
Posted by Thomas Weidner (thomas) on 2008-10-14T12:42:49.000+0000
Fixed in both releases
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:11.000+0000
Changing issues in preparation for the 1.7.0 release.