How to use onclick to trigger file diaglog (browse button)?

Discussion in 'JavaScript' started by bobby9101, Aug 9, 2007.

  1. #1
    Hi, i have an a file upload form, but later on the page I want to be able to click a button and using the onclick event, trigger the form input field that would cause the file browser dialog to open.
    How do I trigger a form element with onclick?
    Thanks so much,
    Bobby
     
    bobby9101, Aug 9, 2007 IP
  2. nhl4000

    nhl4000 Well-Known Member

    Messages:
    479
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #2
    nhl4000, Aug 13, 2007 IP
  3. TomDeLonge

    TomDeLonge Peon

    Messages:
    119
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    As far as I remember You can use document.Form1.upload1.click(), but this will work only in IE, other browsers do not allow this due to security issues.

    On very bottom of the page: http://www.quirksmode.org/dom/inputfile.html
     
    TomDeLonge, Aug 14, 2007 IP