File Upload Issue - INPUT type="file" and Use of .click()

Discussion in 'ASP .Net' started by HVG, Jun 12, 2004.

  1. HVG

    HVG Guest

    Hi, does anyone know why using ".click()" on a <INPUT type="file"> control
    should be a problem?

    - the html file selction control is on a very plain webform page with just
    the <input type="file"> control and a submit button.
    - the ".click()" method is simply used to automatically open the file
    selction dialog box so the user doesn't have to click "Browse". (likewise
    the form is automatically submitted when the user selects a file).
    The wierd effect is:
    - When the user first clicks the submit button (after selecting a file),
    the form does not submit, and the file selction input control clears
    - If the user now selects a file again by clicking the "Browse" button
    manually, the process works just fine.

    So I guess the file selction control is not executing something internally
    when we simulate a "Browse" button click by envoking the "click()" method.
    Any ideas much appreciated.

    Regards
    Hugo
     
    HVG, Jun 12, 2004
    #1
    1. Advertising

  2. HVG

    Natty Gur Guest

    Hi,

    For security reasons only the user can explicitly choose files to
    upload. Any manipulation to do it by code will not succeed.

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)52-8888377


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 13, 2004
    #2
    1. Advertising

  3. HVG

    HVG Guest

    Aha, that explains it.
    Thanks
    Hugo

    "Natty Gur" <> wrote in message
    news:...
    > Hi,
    >
    > For security reasons only the user can explicitly choose files to
    > upload. Any manipulation to do it by code will not succeed.
    >
    > Natty Gur[MVP]
    >
    > blog : http://weblogs.asp.net/ngur
    > Mobile: +972-(0)52-8888377
    >
    >
    > *** Sent via Devdex http://www.devdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    HVG, Jun 13, 2004
    #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. Brian Henry
    Replies:
    1
    Views:
    656
    Steven Cheng[MSFT]
    Jul 20, 2004
  2. Stephen Riek
    Replies:
    0
    Views:
    4,493
    Stephen Riek
    Sep 19, 2003
  3. Maris Janis Vasilevskis

    File upload without Input type=file

    Maris Janis Vasilevskis, Jul 28, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    5,088
    Kevin Spencer
    Jul 28, 2006
  4. RWK

    File Upload - <input type=file>

    RWK, Jan 27, 2005, in forum: Javascript
    Replies:
    3
    Views:
    149
    Grant Wagner
    Jan 27, 2005
  5. SammyBar
    Replies:
    3
    Views:
    228
    Randy Webb
    Jan 12, 2007
Loading...

Share This Page