This works on everything I've tested so far.

$file = "/some/path/to/file";
header("Content-Disposition: inline; filename=" . basename($file));
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file));
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
readfile("$file");
exit();

Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net

----- Original Message -----
From: "Oscar F" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 27, 2002 5:46 PM
Subject: [PHP] Sending a File to User's Browser


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.

Any ideas??.. :)

  Oscar.-



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to