note 41597 deleted from function.header by betz
| From: | betz@php.net | Date: | Sun, 18 Apr 2004 13:39:57 +0000 |
| Subject: | note 41597 deleted from function.header by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68290@lists.php.net to get a copy of this message | ||
Note Submitter: kidgeek@kidgeek.com
----
Well thanks for the code... however I had problems with yours and another piece of code I found on
phpbuilder.com
I combined the two and came up with a great little function...
<?php
$path '/path-to-your-directory/';
if(isset($_GET["downaction"]))
{
$file_name=$_GET["file_name"];
header('Pragma: public');
header('Content-Transfer-Encoding: none');
header("Content-type: application/octetstream; name=".$_GET["file_name"]);
header("Content-Disposition: attachment; filename=".$_GET["file_name"]);
@readfile($path.$file_name);
}
?>
Now just call the code like this...
download.php&downaction=filedownload&file_name=filename.jpg