For file extension Regular expression can be made very simply.
(.*\.([Pp][Dd][Ff])$) For pdf
For two like pdf and zip both
(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])$)
Like same we can create for all
(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])|.*\.([Rr][Aa][Rr])|.*\.([Xx][Ll][Ss][Xx])|.*\.([Xx][Ll][Ss])|.*\.([Dd][Oo][Cc])|.*\.([Dd][Oo][Cc][Xx])$) For pdf zip rar xlsx xls doc docx
Can be used in regular expression in file upload control in asp.net as follow :--
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="Only .zip, .rar, .xlsx, .xls, .pdf, .doc, .docx files are allowed" ValidationExpression="(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])|.*\.([Rr][Aa][Rr])|.*\.([Xx][Ll][Ss][Xx])|.*\.([Xx][Ll][Ss])|.*\.([Dd][Oo][Cc])|.*\.([Dd][Oo][Cc][Xx])$)"
Display="Dynamic" ValidationGroup="submit"></asp:RegularExpressionValidator>
(.*\.([Pp][Dd][Ff])$) For pdf
For two like pdf and zip both
(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])$)
Like same we can create for all
(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])|.*\.([Rr][Aa][Rr])|.*\.([Xx][Ll][Ss][Xx])|.*\.([Xx][Ll][Ss])|.*\.([Dd][Oo][Cc])|.*\.([Dd][Oo][Cc][Xx])$) For pdf zip rar xlsx xls doc docx
Can be used in regular expression in file upload control in asp.net as follow :--
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="Only .zip, .rar, .xlsx, .xls, .pdf, .doc, .docx files are allowed" ValidationExpression="(.*\.([Pp][Dd][Ff])|.*\.([Zz][Ii][Pp])|.*\.([Rr][Aa][Rr])|.*\.([Xx][Ll][Ss][Xx])|.*\.([Xx][Ll][Ss])|.*\.([Dd][Oo][Cc])|.*\.([Dd][Oo][Cc][Xx])$)"
Display="Dynamic" ValidationGroup="submit"></asp:RegularExpressionValidator>
VsimpducAguere1984 Jeff Sumter download
ReplyDeleterapabenly