If there are required fields in a form (ie '#required' is set to TRUE), and the user sets a file to be uploaded but not provide all the required fields, validation fails on the required fields and the validation hook does not get called; the specified file does not get uploaded (if that is where the upload code is placed) and the form is refreshed without the previously provided filename wiped out. Is there a way to either upload the file during validation, or reset the filename in the form field, so that the user doesn't have to reselect it again?
thanks