Re: raw file header in http
| From: | Andre P. | Date: | Thu, 21 Jun 2001 18:29:44 +0000 |
| Subject: | Re: raw file header in http | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9702@lists.php.net to get a copy of this message | ||
Try the following:
create a link to a script download.php which will read the file (from anywhere on the disk) and send it to the user like this:
header("Content-Type: application/force-download");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=".$orig_filename);
readfile($filename);
exit;
This should give him a download dialog box and set the filename in the dialog box to $orig_filename.
hope this helps
ciao
andre.
schiarat@libero. wrote:
I' ve a file in a directory(/tmp) out from http root of web server. I need to open a page that send this file when it is opened (es.: opening page.php under netscape it opens a request to save file to disk, but the "file is out of www root"), i think i t is possible using command header and a raw http command, but i aven't any idea if it is possible and if yes in what mode. The system i use is apache 1.3.9 under redhat linux 7.1, tank's Omar