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

have got a task to upload new file from the click of image button. My code is


asked Apr 13, 2015 in PHP by rajesh
0 votes

2 Answers

0 votes
You could add a hidden file input field, like:" width="30px"/>

And do:

$("input[type='image']").click(function() {
answered Apr 13, 2015 by rajesh
0 votes
you are using the wrong input, use file instead, if you want the button to loke like the circle in your code demo you will need to use CSS to change the way "submit" looks like. This has to be in a form:


I don't know what language are you using in the server-side (PHP, ASP.NET, etc) but you will need to create a page (for xample "upload_file.php" for php). You can easily find examples in google about how to create a page like that, just copy pasete the code:

An example in PHP:

Hope it helps :)
answered Apr 13, 2015 by rajesh