note 18265 deleted from function.fpassthru by felipe
| From: | felipe@php.net | Date: | Fri, 04 Jan 2008 01:39:55 +0000 |
| Subject: | note 18265 deleted from function.fpassthru by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134748@lists.php.net to get a copy of this message | ||
Note Submitter: mirko at mcaserta dot com
----
To display a "Save as..." box which displays the name of the file you're sending to
the user:
<?
$completeFilePath=$fileDir.'/'.$fileName;
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header("Content-type: application/octet-stream\nContent-Disposition: inline;
filename=\"".$fileName."\"\nContent-length:
".(string)(filesize($completeFilePath)));
$fd=fopen($completeFilePath,'r');
fpassthru($fd);
?>
The first two header calls are only needed to make sure the client doesn't cache the document.