Hi,
I am working on Web Application using C#, ASP.Net2.0, MSSQL 2005
I need to upload the file, so I read the article from the MSDN
http://msdn2.microsoft.com/en-us/library/aa479405.aspxNow I want to upload only Excel file.
So, from MSDN I got this kind of validation we can put
<asp:RegularExpressionVali
dator
id="RegularExpressionValid
ator1" runat="server"
ErrorMessage="Only mp3, m3u or mpeg files are allowed!"
ValidationExpression="^(([
a-zA-Z]:)|
(\\{2}\w+)
\$?)(\\(\w
[\w].*))
+(.mp3|.MP3|.mpeg|.MPEG|.m
3u|.M3U)$"
ControlToValidate="FileUpl
oad1"></as
p:RegularE
xpressionV
alidator>
So, I changed the above code to as per my requirement as follows
<asp:RegularExpressionVali
dator
id="RegularExpressionValid
ator1" runat="server"
ErrorMessage="Only Excel (.xls) files are allowed!"
ValidationExpression="^(([
a-zA-Z]:)|
(\\{2}\w+)
\$?)(\\(\w
[\w].*))
+(.xls)$"
ControlToValidate="FileUpl
oad1"></as
p:RegularE
xpressionV
alidator>
I get the error
Only Excel (.xls) files are allowed!
But I am chossing Excel file only has the path
C:\dinesh\Projects\Project
Name\Docum
ents\Sampl
e MTOs EE108 (DWP-06-6100EK)(1).xls
Please help me in correcting RegularExpressionValidator
Many Thanks
Start Free Trial