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.
Sounds like you might be moving the uploaded file to images/photos
before
checking if the submitted form is valid.
Does the validator on the element break the validation chain? Maybe
that is it. If it doesn't the rest would keep on processing.
Generally, might be not a bad idea to upload the image and ask the
user to correct the missing input. :-)
Till
The way I see it, the file should *not* be put in the destination folder
unless *all* of the form elements validate.
This depends on how you wrote your code. Actually we can only expect what
you did as you only gave the form but did not outline how you did the
validation.
Example:
When you call getValues() before validation, then you will revceive all
values from the form.
But for the file element, the file itself is the value. In this case the
file is transferred when only the validation of the file element is valid as
you don't validate the whole form but each value independently from all
other elements.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com