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