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? -

java - How to create Table using Apache PDFBox -

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -