Say I have a link to an image <a href="something.jpg">Save</a> how do I force it to ask user where they want to download instead of opening the image in a browser
What the browser does is not really on your control (or shouldnt). But what happens whenever a browser follows a link, is check the content typ returned by the HTTP header of the web server. Then the browser has a configuraion for many of these, in Image files the action is usually "display on browser window"(or something similar) If you wnt to force the download, set your webserver to serve the file with another content type so the browser won't know it is an image and ask the user what to do with the file. Save it or open it with some other program.
Add the following to your htaccess file (or create one): <Files *.jpg> ForceType applicaton/octet-stream </Files> Code (markup):
hmmm thanks guys... I'm going to try it out... but I'm not necessarily looking to turn all; say, jpg in force download. Just have a save button for those users who doesn't know about right click -> save image as. But maybe its not really necessary
use php headers : header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: 134253463); header('Content-Disposition: attachment; filename=YOUR-IMAGE.PNG');