Hi all. I have this file upload element and it is a NOT required element (setRequired(false)):

$mainpic = $this->createElement('file','mainpic');
       $mainpic->setLabel('Immagine di riferimento:')
               ->setDestination('/tmp');
       // ensure only 1 file
       //$mainpic->addValidator('Count', false, 1);
       // limit to 100K
       $mainpic->addValidator('Size', false, 102400);
       // only JPEG, PNG, and GIFs
       $mainpic->addValidator('Extension', false, 'jpg,png,gif');
       $mainpic->setDecorators($decorators)
->addDecorator('HtmlTag',array('tag' => 'div', 'class' => 'field_mainpic')) ->addDecorator('Description', array('escape' => false, 'tag' => 'span', 'class' => 'description'));

My problem is that when I click the submit button my form is not valid and the error is in the file element, and these are the error messages :

   * The file '' could not be found
   * The file '' was not found


Where is my error ? The problem are the 'Count' and 'Extension' validator, but why they run if the file is not required ?

M.

--
Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ajaxblog.it MSN: mic...@ziobuddalabs.it JABBER: mic...@gmail.com

Reply via email to