views:

65

answers:

1

I want to make a link download like this

http://idwallpaper.com/download.php?image_id=1517

I have tried from other tutorial like this

<script>
function SaveFile(fname){
img.document.execCommand('saveas', null ,fname)
}
</script>


<iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0px"></iframe>



<button onclick="SaveFile('myimage.jpg');">save as</button>

Does not work in FireFox though.....

+1  A: 
<a href="myimage.jpg">Save As</a>

Plus a Content-Disposition header to set it as an attachment. You can adapt this PDF example if you use Apache.

David Dorward