Take the 2-minute tour ×

Is there a way to trigger the click even of :

<input id="test" type="file">


share|improve this question

5 Answers 5

I was looking for the same thing and found an answer at trigger file upload dialog using javascript/jquery and a running example is at http://jsfiddle.net/CSvjw/

it simply does

share|improve this answer

Dont use display:none or visibility:hidden initially in the css

In Jquery:

$(document).ready(function() {
share|improve this answer
that really helped me ..... awesome....i was not able to figure out why it is working ....but it is work...:) –  Varun Agarwal Dec 4 '12 at 8:06

As far as I know, there is no way to trigger it programmatically for security reasons. You got to click it explicitly.

share|improve this answer
See Khaled's comment below. All you have to do is trigger a click in JavaScript of the file input. –  Neil Monroe Nov 9 '12 at 20:27
Prefilling an input type file is definitely not possible because of security considerations (stealing a user's files without his consent or knowledge), but opening it is allowed by browser, and can be done like this. –  Gopal Aggarwal Oct 11 at 12:11

Not possible (security reasons).

share|improve this answer

No, there isn't, and this is a good thing as it would be extremely annoying for the user. Whether a user wants to upload some file is in is control only, personally I would hate a site automatically sticking an Open Dialog into my nose when I visit it.

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Gerard de Visser Oct 11 at 13:18

Your Answer


