note 6826 modified in copy by jmoore
| From: | jmoore@php.net | Date: | Thu, 10 Aug 2000 21:21:06 +0000 |
| Subject: | note 6826 modified in copy by jmoore | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-976@lists.php.net to get a copy of this message | ||
To serve a file to a client from the server you can do this: (This also enables dynamic file content
just by altering what is echo'd out)
<pre>
<?
$fp = fopen("file.x","r");
$buff = fread($fp,1000000);
Header("Content-Type: application/x-octet-stream");
// you can put the header file-length here but I never use it!
Header("Content-Disposition: attachment; filename=DOWNLOADEDFILENAMEHERE"); echo $buff;
</pre>
this will trigger the download action.
joe
http://www.php.net/manual/function.copy.php