javascript - How can I upload a new file on click of image button -


i have got task upload new file click of image button. code is

    <label>file</lable>     <input type="image" src="http://upload.wikimedia.org/wikipedia/commons/c/ca/button-lightblue.svg" width="30px"/> 

on click of button want upload new file.how can this? can check code demo

you add hidden file input field, like:

<input type="image" src="http://upload.wikimedia.org/wikipedia/commons/c/ca/button-lightblue.svg" width="30px"/> <input type="file" id="my_file" style="display: none;" /> 

and do:

$("input[type='image']").click(function() {     $("input[id='my_file']").click(); }); 

demo:: updated fiddle


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -