Making an image downloadable |
Making an image downloadable |
![]()
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() Group: Member Posts: 50 Joined: Jul 2007 Member No: 541,260 ![]() |
Anyone know a code for making an image (or text) downloadable when you click it? Not a zip file ...just a regular download that saves to the computer
|
|
|
![]() |
![]()
Post
#2
|
|
![]() Senior Member ![]() ![]() ![]() ![]() Group: Member Posts: 122 Joined: Feb 2005 Member No: 106,057 ![]() |
There is a way to do it, and it involves either PHP / some sort of server side scripting or a server setting, which I'd doubt your host would allow. Personally I usually work with ASP, so I don't know the exact syntax for PHP, but look through the PHP reference for setting something called the MIME type. If you can have the php file send the image file (so your image is downloaded directly by the php file, such as image.php?image=thingy.jpg without any redirects or html), set the MIME type to "application/octet-stream". Additionally, you'll also need to set the content-disposition header, as described here: http://support.microsoft.com/kb/260519 (doesn't show PHP syntax, though).
A simpler way would be to have a server setting so that all jpeg files in, say, the "downloads" folder will automatically have the MIME type and content-disposition header set as described above. I wish I could give you a more specific example, but unfortunately I'm not much of a PHP coder =( |
|
|
![]() ![]() |