Is there a way to open file dialog box to upload a file, on click of an button or an image, or an link..
for example :
<a href="" onclick="openDialogBox('fileID')....." /> Select File To Upload</a>
<input type="file" id="fileID" />
I need simpliest example which will work in all browsers. Id like to use pure javascript or ajax.
This is the way I’ve dealt with just HTML & CSS
(And I think it’s not necessary to call any javascript through):
See fiddle here : Deal with ugly browse button
Strategy is to make a file-input with opacity=0 and position:absolute inside a container with position:relative. Thus, the input was invisible to user but when they click the container, the input click event will be triggered as expected.
What you can do to make this fit your own needs :
Good luck!