c# - RegularExpressionValidator always show error message -
here code of aspx:
<asp:fileupload id="imageupload" runat="server" style="margin-bottom: 5px" /> <br /> <asp:regularexpressionvalidator id="regularexpressionvalidator1" runat="server" errormessage="only jpeg, png or gif files allowed!" validationexpression="^(([a-za-z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*)) +(.jpeg|.jpeg|.png|.png|.gif|.gif)$" controltovalidate="imageupload"></asp:regularexpressionvalidator> i want filter jpeg, png , gif file in imageupload . , when upload jpeg,png , gif file , regularexpressionvalidator show error message .i want know what's wrong in code !
if want assert extension try this:
\.(jpeg|jpeg|png|png|gif|gif)$ this match ends in . followed either of above extensions.
edit:
without having tried , having no experience aspx, think should able use (?i:) make case insensitive:
(?i:\.jpeg|png|gif)$
Comments
Post a Comment