20

I want to have an Open File dialog box on a link in my webpage.

I tried

<input name="uploadedfile" type="file">

but, it works as a button. And, doesn't allow to select multiple files.

I want to have something like

<a href="#" onclick="some_function_for_OpenFileDialogBox">Upload Files</a>

Please suggest.

Thank You

Kaur

Satinder singh
  • 10,100
  • 16
  • 60
  • 102
kaur
  • 567
  • 1
  • 7
  • 24

1 Answers1

48

You can only open a "Open File" dialog using a input type=file tag. However the efect you are looking for can be accomplished like this :

<input type="file" id="upload" name="upload" style="visibility: hidden; width: 1px; height: 1px" multiple />
<a href="" onclick="document.getElementById('upload').click(); return false">Upload</a>
d4rkpr1nc3
  • 1,817
  • 13
  • 16