File Upload Control Validation not working in firefox

I have tried to validate the File Upload Control to Upload only Video files. I have used the following validation expression in Regular Expression Control.

^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.wmv|.mov|.mp4|.avi)$

The above validation is working in IE and Chrome, but the Firefox not supported this expression.
So I googled for that, and I found a useful link http://forums.asp.net/t/1342216.aspx/1
By referring the above link, I have modified my expression as follows

(.*\.([wW][mM][vV]|[mM][oO][vV]|[mM][pP][4][aA]|[vV][iI])$)

After saving the page and I tested and got worked in all browsers.

After updating, the Regular expression control looks like as follows,

<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server”
ErrorMessage=”Only video files are allowed.”
ValidationExpression=”(.*\.([wW][mM][vV]|[mM][oO][vV]|[mM][pP][4][aA]|[vV][iI])$)”
ControlToValidate=”fileUploadControl” >
Only Video files are allowed
</asp:RegularExpressionValidator>

Leave a Reply

Your email address will not be published. Required fields are marked *