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>";
}