Last post Sep 16, 2009 04:56 PM by gjcm
Nov 02, 2008 04:52 AM|naveedali|LINK
I am using the Regular Expressions given below to validate files to be uploaded using FileUpload control
Above regular expression are working fine in Internet explorer but not working in Firefox 3.0.3...
Let me know if you have any expression which works fine in both the browsers ... and any reason u know .. Why it is not working in Firefox
Nov 02, 2008 08:14 AM|NC01|LINK
If you are using that client-side, Firefox 3 probably has restrictions about accessing the FileUpload control client-side (which is the way it is supposed to be). The only sure way is to do the validation server-side.
Nov 02, 2008 08:31 AM|A1ien51|LINK
If you look at the value of the file input control in Firefox closely you will see thta it only shows the file name and not a full path. If your reg exp taking that into account?
Nov 03, 2008 12:19 AM|susain|LINK
Try this expression instead of above (.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[bB][mM][pP])$)
I have tested in ie and mozilla as well working fine.
Nov 06, 2008 08:34 AM|naveedali|LINK
Nov 07, 2008 02:52 PM|tajy|LINK
How exactly did you write the expression to make it work in firefox?
I wrote it like this and it still only works in IE and not firefox:
In firefox, it gives the error messgae but it still uploads non validated files to the server.
Can you show me exactly what you wrote for your expression and does this really work in firefox?
Nov 08, 2008 03:39 AM|naveedali|LINK
Just Copy and Paste this expression:
Nov 08, 2008 12:41 PM|tajy|LINK
I don't know what I'm missing or entering wrong but it still doesn't do client side validation
in firefox. In IE it gives the error message and does not upload a non validated file.
In firefox it gives the error message but still uploads the non validated file to the server.
Here's what I entered:
<asp:RegularExpressionValidator ID="valUploadFile" runat="server"
ErrorMessage="must be a jpg, bmp. or gif file">*</asp:RegularExpressionValidator>
Is it possible that using asp.net 1.1 is causing the expression not to work?
Nov 08, 2008 09:28 PM|tajy|LINK
Update: It's working now
My web application is in asp.net 1.1.
I requested the web hosting company to switch the server to run asp.net 2.0(the hosting company runs both 1.1 & 2.0)
Now the expression is working perfectly in firefox, IE, and Opera. I haven't checked any other browsers.
Mar 01, 2009 09:23 AM|dead_zone2006|LINK
how can i modify this expression to allow only doc, docx,rtf,pdf
Apr 10, 2009 12:38 PM|tajy|LINK
You can modify it this way:
or you can try one of these expressions:
Hope this helps
Sep 16, 2009 04:56 PM|gjcm|LINK
None of the expressions I tried in Firefox worked until I put the expression in (), then they all worked in both IE and Firefox.
[a-zA-Z\\].*(.pdf|.PDF)$ -- does not work in Firefox