Re: php file list with forced download
| From: | Richard Lynch | Date: | Tue, 17 May 2005 20:02:41 +0000 |
| Subject: | Re: php file list with forced download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215409@lists.php.net to get a copy of this message | ||
On Mon, May 16, 2005 5:49 pm, Miguel Vaz said:
> Was coding a directory listing for several dirs on a client's server that
> would list the files and allow users to download them. The question is, is
> there a way to force download of all files, regardless of their types?
> i.e., if the list constains a .jpg, the browser will show it instead of
> asking the user to download. Also for .html, gifs, etc.
<?php
header("Content-type: application/octet-stream");
readfile("/full/path/to/your/file");
?>
Any browser that doesn't force a download for application/octet-stream is
in violation of every HTTP protocol version ever published.
Even *MICROSOFT* hasn't screwed this one up. Yet...
--
Like Music?
http://l-i-e.com/artists.htm