Hi,

I have an optional File upload element on my form, the current docs state
the following to get an optional form element:

$element = new Zend_Form_Element_File('foo');
$element->setLabel('Upload an image:')
        ->setDestination('/var/www/upload')
        ->setRequired(false);
$element->addValidator('Size', false, 102400);
$form->addElement($element, 'foo');

// The foo file element is optional but when it's given go into here
if ($form->foo->isUploaded()) {
    // foo file given... do something
}


When I try to sybmit the form without using the upload element I get the
fllowing error: *

The file '' could not be found*.

If I remove the validator I do not get an error, and the form processes
correctly albeit without validaiton on the element.

I also check if a file has been upload with the isUploaded() method but it
seems the a validator still gets fired even with setRequired set to false,
is this a mistake in the docs or
could this be an issue with the logic of my own code?

Thank You
Daniel Latter

Reply via email to