What do do you mean with "name fales validation" ?
The file element is a part of the form which is transferred.

This means that your browser submits all data (including the file) and then this data is validated.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

In this example of uploading a file with Zend_Form:

       $this->addElement('text', 'name', array(
           'label' => 'Name',
           'required' => true,
           'validators' => array(
               array('StringLength', false, array(1, 255))
           ),
           'maxlength' => 255
       ));
       $file = $this->createElement('file', 'photo', array(
           'label' => 'Photo',
           'destination' => 'images/photos',
           'validators' => array(
               array('Count', false, 1),
               array('Size', false, 202400), // 102400 100K
               array('Extension', false, array('jpg', 'case' => true)),
               array('IsImage', false, 'jpeg'),
           )
       ));
       $this->addElement($file);


There are two elements and the name element is required.

Now if you add a file to upload but the name element *fails* validation the
file is still uploaded to the "images/photos" folder.

Is this correct behavior, a bug or something wrong/bad in my code elsewhere?

Thanks.


--
View this message in context: http://www.nabble.com/Zend_Form_Element_File--tp23990412p23990412.html Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to