note 15656 rejected from function.header by zak
| From: | zak@php.net | Date: | Tue, 25 Sep 2001 16:36:13 +0000 |
| Subject: | note 15656 rejected from function.header by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18295@lists.php.net to get a copy of this message | ||
If I open url "download" in new window - that's all right with right downloading. But
I need to download "manual.log" without loading new window - unfortunately in this case
the following code return me the page with it,but not the attachment "manual.log" that I
want.
P.S. It is important that user get "manual.log" with another name - "yo.txt"
if ($file) {
header ("Content-Type: application/octet-stream");
header ( "Content-Length: ".filesize("manual.log"));
header ( "Content-Disposition: attachment; filename=yo.txt");
readfile("manual.log");
exit();
}
elseif ($id) {
echo "<a href=$PHP_SELF?file=$id>download</a>";
}