OPEN FILE DIALOG BOX ON <A> TAG

Alex Leblois

Total Post:67

Points:471
Posted by  Alex Leblois
HTML5 
 2417  View(s)
Ratings:
Rate this:

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

  1. Ankit Singh

    Post:341

    Points:2389
    Re: Open File Dialog box on <a> tag

    Hi Alex,

    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!