>Hello,
>
>I need a user to save an image file to their disk. Normally when someone
>clicks on an link to a .jpg file, the fil will display on the same browser
>window, since it is capable of displaying such files. Now, I don't want
>this to happen, I need to be able to show the user the "Save As.." dialog
>when they click the link. I know it can be done bc I've seen it in
>phpMyAdmin, when you want to save the database dump. If you dont click
>"Save as file" it just displays the text in your browser.
<A HREF=download.php/whatever.jpg?filename=whatever.jpg>Download
Whatever.jpg</A>
--------- download.php -----------------
<?php
header("Content-type: application/octet-stream");
header("Content-length: " . filesize("/path/to/$filename"));
readfile("/path/to/$filename");
?>
NOTES:
Some stupid browsers will *INSIST* on using the URL to "guess" what kind of
file it is, and what default name to prompt with, no matter *what* headers
you send. That's why the funky extra whatever.jpg is between the / and the
? in the link.
There are more headers like Content-disposition to convince even more
browsers to do the right file name in the prompt.
--
Like Music? http://l-i-e.com/artists.htm
I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
major distro). Need to record live events (mixed already) to stereo
CD-quality. Soundcard Recommendations?
Software to handle the recording? Don't need fancy mixer stuff. Zero (0)
post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
audio-to-disk.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php