note 41597 added to function.header
| From: | kidgeek at kidgeek dot com | Date: | Fri, 16 Apr 2004 03:07:41 +0000 |
| Subject: | note 41597 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68185@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41597
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41597&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41597&report=yes
Search -- http://master.php.net/manage/user-notes.php