c# - Fileupload Regular expression validation fails for certain file name in asp.net -
I am using the fileupload control to upload the file and to validate the filename at the same time I am using the expression.
I want to follow the file extension to upload for .pdf I'm not sure why this fails when it works for I want to allow any file name with the extensions mentioned above. try it .doc, .docx, .pdf .Use the following command for the valid filename
validationXpress = "[a-zA -Z \\]. * (.doc | .doc | .docx | .docx | .pdf | .pdf) $"
& lt; Asp: fileUpload id = "FileUpload1" runat = "server" CssClass = "fileUpload" /> & Lt; Asp: RequiredFieldValidator id = "ValidateF1" runat = "server" error message = "*" CssClass = "row-valid" ControlToValidate = "FileUpload1" & gt; & Lt; / asp: RequiredFieldValidator & gt; & Lt; Asp: RegularExpressionValidator id = "ValidateEx" runat = "server" Validation Execution = "[a-zA-Z \\]. * (.doc | .doc | .docx | .docx | .pdf | .pdf) $" ControlToValidate = "FileUpload1" Validation Group = "Career" Error Message = "*" & gt; & Lt; / asp: RegularExpressionValidator & gt;
ABC_COMPANY_Privacy_v4.0_123456 (5) .pdf
validation expression = "^. *. (Doctor | DOC | DOCX | PDF | PDF) $ "
Comments
Post a Comment