HtmlInputFile Probblem

Discussion in 'ASP .Net Web Controls' started by Wayne Wengert, Mar 4, 2005.

  1. 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
     
    Wayne Wengert, Mar 4, 2005
    #1
    1. Advertising

  2. Wayne  Wengert

    paulanthony Guest

    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".
     
    paulanthony, Mar 4, 2005
    #2
    1. Advertising

  3. 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:...
    > 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".
    >
     
    Wayne Wengert, Mar 4, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bruce barker

    Re: HELP - HtmlInputFile Server Control

    bruce barker, Jul 17, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    bruce barker
    Jul 17, 2003
  2. Paul Hobbs

    Replicate HTMLInputFile functionality

    Paul Hobbs, Aug 3, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    332
    Paul Hobbs
    Aug 3, 2003
  3. szabelin
    Replies:
    0
    Views:
    473
    szabelin
    Aug 4, 2003
  4. Eric Sabine
    Replies:
    0
    Views:
    341
    Eric Sabine
    Aug 25, 2003
  5. Garg Pankaj

    HtmlInputFile accept property

    Garg Pankaj, Aug 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,418
    bruce barker
    Aug 26, 2003
Loading...

Share This Page