Firefox 3.0.1 and FileUpload validator issues

One of our clients today noted an issue where a RegularExpressionValidator for a FileUpload control was failing in FireFox 3.0.1 only. My guess is that version 3.0.1 was doing something new with the filename when posting to the server. Or something.

Anyhow, the “fix” I came up with was to set EnableClientScript to false, and instead of using a validation expression like this

"^(([a-zA-Z]:)|(\{2}w+)$?)(\(w[w].*))(.jpg|.JPG|.gif|.GIF)$"

changed the validator to use something like this

"^.+.((jpg)|(gif)|(jpeg)|(png)|(bmp))$"

and then ensured that I’m checking the file’s existence in the codebehind.

Thanks to Wen Ching’s blog post for the regex idea.

0