ZF-9871: Ignore next validators
Description
If use upload multifile (eg 3) and upload only "file_2" and set option "ignoreNoFile => true", after validate "file_1" for files "file_2", "file_3" etc, other validators be ignored.
Reproduction:
$this -> setMethod('post');
$this -> setAttrib('enctype', 'multipart/form-data');
// Images elements $element = new Zend_Form_Element_File('file');
$element -> addValidator('Count', false, array( 'min' => 1, 'max' => 3 ));
$element -> addValidator('MimeType', false, 'image/png');
$element -> setDestination( realpath(APPLICATION_PATH . '/../public/uploads/images' ));
$element -> setMultiFile(3) -> setValueDisabled(true);
$this -> addElement( $element );
I fix this in Zend_Validate_File_Upload method isValid, replace "$this->_value = $file;" to "$this->_setValue($file);" for clean "$this->_messages"
Comments
Posted by Thomas Weidner (thomas) on 2010-05-22T02:10:34.000+0000
The "ignoreNoFile" option can only be set on elements/files. A multifile is a file which consists of several parts (where luckily each part is a file itself).
This means "ignoreNoFile" is set on the multifile, not on a part of this multifile. This is no bug but wished behaviour.
When you want to have several independend files then use multiple file elements instead of the multifile feature.
Posted by Thomas Weidner (thomas) on 2010-06-09T12:09:55.000+0000
Fixed with r22399 Given solution problematic... fixed it differently