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 .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;   

.pdf I'm not sure why this fails when it works for ABC_COMPANY_Privacy_v4.0_123456 (5) .pdf

I want to allow any file name with the extensions mentioned above.

try it

  validation expression = "^. *. (Doctor | DOC | DOCX | PDF | PDF) $ "   

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -