I am using fileupload control to upload file and at same time using regular expression for validating file name.
I want following file extension to be uploaded for .doc, .docx, .pdf i use following
command to valid file name
ValidationExpression="[a-zA-Z\\].*(.doc|.DOC|.docx|.DOCX|.pdf|.PDF)$"
<asp:FileUpload ID="FileUpload1" runat="server" CssClass="fileUpload" />
<asp:RequiredFieldValidator ID="ValidateF1" runat="server" ErrorMessage="*" CssClass="row-validate" ControlToValidate="FileUpload1"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="ValidateEx" runat="server" ValidationExpression="[a-zA-Z\\].*(.doc|.DOC|.docx|.DOCX|.pdf|.PDF)$" ControlToValidate="FileUpload1" ValidationGroup="Careers" ErrorMessage="*"></asp:RegularExpressionValidator>
It fails to validate following file name
(K)+J01461+abced+high+En+(HR)(1).pdf I am not sure why it fails while it works for ABC_COMPANY_Privacy_v4.0_123456(5).pdf
Am i using the wrong validation expression. I want to allow any file name with extension as mentioned above.