Is the validation code above the file upload code? UploadResult values can't be validated before the file upload has processed. Try validating with the form element value from the form directly instead of the file extension from the processed upload.