>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
You read it wrong.
There are two elements in the form.
1. name (which is a text element)
2. photo (which is a file element)
The name *element* (1) is required and has a string length validator of
between 1 and 255 characters.
The photo *element* (2) has several validators.
1. Count equals 1
2. Size less than 202400
3. Extension is "jpg" and lowercase
4. The file is a "jpeg" image.
i.e.
$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);
>What do do you mean with "name fales validation" ?
I didn't say that, i said "the name element *fails* validation", note the
"element". As i said above, there are two elements: one is a file element
(photo) and one is a text element (name).
Now if you add a file to upload (i.e. in the above example you attach a
photo to the form for upload) and the name element (i.e. the text 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?
NOTE: The name *element" fails validation: The name element is the text
element, if no name is given or a name is more than 255 characters long the
name element will *fail* validation.
--
View this message in context:
http://www.nabble.com/Zend_Form_Element_File--tp23990412p24002884.html
Sent from the Zend Framework mailing list archive at Nabble.com.