当可选文件elem时,form isValid()返回false。 存在于zend中

in the controller isValid am facing problem.

if ($form->isValid($formdata)) 

This is my Code Zend_Form code

$document = $this->addElement('file','orglogo');
    $document = $this->getElement('orglogo')                    
                      ->removeDecorator('label')
                      ->addValidator('Extension', false, array('jpg,png,gif,jpeg'))
                      ->setRequired(true)
                      ->addErrorMessage('Please upload a valid File  (jpg,png,gif,jpeg)');

Its displaying error

File 'orglogo' exceeds the defined ini size

How can i solve this error.


Hurrrrrrrrrrrrrray!!!

Finally i got solution.

Add enctype="multipart/form-data" in your form.

Hope this will help someone.

Cheeeeeeeers, Sathish

If the form error arrays are empty then it might be a problem with setting the value of the elements from data.

Do the column names in couchdb match the names of the elements in the form? If not, then it probably isn't even trying to validate each element since assigning the elements their value is what is failing.

When the user submits the form the $data['filename_element'] does not exists if the user didn't select any file, but if you take the database row you will always have an string of length 0 $data['filename_element'].

Do a exit(var_dump($data)); on both the user supplied data and the database row and you will see the difference. P.S. 'filename_element' needs to be replaced with the id of your file element.