I have an image in my page. I want the image to be downloaded when I click on a button. How can I do this using jQuery or Javascript? Kindly provide me with a fiddle. FIDDLE
<div id="download">
<img src="http://www.glamquotes.com/wp-content/uploads/2011/11/smile.jpg" id="image">
<button id="dwnld"> Download image </button>
</div>
save.php will return
"1|DOWNLOAD_NOS|FULL_PATH|FILE_NAME" Or you may use jSON
You can actually do this with the HTML5
download
attribute, if older browsers are an issue, you should use the serverside for this, and set the appropriate headers etc.FIDDLE