Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > HtmlInputFile Probblem

Reply
Thread Tools

HtmlInputFile Probblem

 
 
Wayne Wengert
Guest
Posts: n/a
 
      03-04-2005
I want to restrict the file types that the user can select to "*.jpg". From
what I read in MSDN there is a property (accept="image/*") that should allow
only image type files and then my code would need to check for the jpg type.
When I try to add (accept="image/*") to the <input type="file"...> the VSNET
IDE flags it as an invalid selection?

How should I resolve this?

Wayne


 
Reply With Quote
 
 
 
 
paulanthony
Guest
Posts: n/a
 
      03-04-2005
Add a RegularExpressionValidator to the page.
Set 'controltovalidate' to the id of the file-input control.
Set 'validationexpression' to something like:

"^(([a-zA-Z]|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.bmp|.BMP||.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG)$ "
- picking the file extensions you need.
And then set 'errormessage' to whatever you like...
Note: Ensure the file-input control is set as runat="server".

 
Reply With Quote
 
 
 
 
Wayne Wengert
Guest
Posts: n/a
 
      03-04-2005
Thanks for the suggestion. I'll give that a try. I guess the accept property
just isn't supported.

Wayne

"paulanthony" <> wrote in message
news: oups.com...
> Add a RegularExpressionValidator to the page.
> Set 'controltovalidate' to the id of the file-input control.
> Set 'validationexpression' to something like:
>
>

"^(([a-zA-Z]|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.bmp|.BMP||.gif|.GIF|.jpg|.JPG|
..jpeg|.JPEG)$"
> - picking the file extensions you need.
> And then set 'errormessage' to whatever you like...
> Note: Ensure the file-input control is set as runat="server".
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HtmlInputFile accept property Garg Pankaj ASP .Net 1 08-26-2003 01:03 AM
Altering error for HTMLInputFile when limit exceeded Eric Sabine ASP .Net 0 08-25-2003 03:11 PM
System.Web.UI.HtmlControls.HtmlInputFile szabelin ASP .Net 0 08-04-2003 10:21 PM
Replicate HTMLInputFile functionality Paul Hobbs ASP .Net 0 08-03-2003 07:08 AM
Re: HELP - HtmlInputFile Server Control bruce barker ASP .Net 0 07-17-2003 04:44 PM



Advertisments