Re: Sending a File to User's Browser

From: Date: Sat, 27 Jul 2002 00:15:13 +0000
Subject: Re: Sending a File to User's Browser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110015@lists.php.net to get a copy of this message
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" <lists@webdevfm.com> To: <php-general@lists.php.net> 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.-

« previous php.general (#110015) next »