ZF-9871: Ignore next validators

Issue Type: Bug Created: 2010-05-21T03:28:41.000+0000 Last Updated: 2010-06-09T12:09:57.000+0000 Status: Resolved Fix version(s): - 1.10.6 (22/Jun/10)

Reporter: p0is0n (p0is0n) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate_File

Related issues: Attachments:


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.


$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"


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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.