Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    It's much, much more elegant solution than making the input field transparent Commented Jul 2, 2015 at 6:23
  • I used the same technique (in pure js: form.file_selector.click();) where file_selector is a dynamically added file input (added by innerHTML). but it does not work. Any help or suggestions please? Commented Aug 2, 2016 at 13:26
  • 1
    @Ron van der Heijden thank you i think i figured out why it was not working (now it's working anyway). For those that may have similar issue may be the cause if that for security reasons the event does not fire unless it's called after user event (click or so). i was tying to fire the event just after (inside a function of) an ajax request. Commented Aug 5, 2016 at 23:01
  • 1
    How can I get selected folder path ?? Commented Jul 29, 2019 at 9:15
  • It's better to use opacity: 0 to hide the file input instead of visibility: hidden or display: none, because assistive technology interprets the latter two styles to mean the file input isn't interactive. developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file Commented May 30, 2022 at 20:12