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
Use the type="file" Attribute in HTML and onchange Method in JavaScript to Open File Dialog. We will create a button element in the following instance, and an onclick attribute will follow this. This will trigger a function in the JavaScript file.
And on the button's click event write the jQuery code like : $('#OpenImgUpload'). click(function(){ $('#imgupload'). trigger('click'); });
OpenFileDialog component opens the Windows dialog box for browsing and selecting files. To open and read the selected files, you can use the OpenFileDialog. OpenFile method, or create an instance of the System.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With