note 42384 deleted from function.readfile by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 09 Aug 2004 06:49:52 +0000 |
| Subject: | note 42384 deleted from function.readfile by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74298@lists.php.net to get a copy of this message | ||
Note Submitter: jackylee@eml.cc
----
<?php
// force to download a file
// ex, ( http://localhost/php/download.php?file=C:/Apache
Group/Apache2/hongkong.php )
// hope this can save your time :-)
$file = $_REQUEST['file'];
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header( "Content-Disposition: attachment; filename=".basename($file));
header( "Content-Description: File Transfer");
@readfile($file);
?>