note 63998 deleted from function.header by nlopess
| From: | nlopess@php.net | Date: | Wed, 05 Apr 2006 08:05:48 +0000 |
| Subject: | note 63998 deleted from function.header by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107367@lists.php.net to get a copy of this message | ||
Note Submitter: Barry
----
Hi
I am having problems of send headers, notably providing a file download link on a webpage.
I have the following 2 files, i get a error message "Warning: Cannot modify header information
- headers already sent by" on every line where the word header(...) appears.
Will someone provide me with guidence on how to overcome the problem
file-1
<HTML>
<HEAD>
<TITLE> File Download Test </TITLE>
</HEAD>
<BODY>
<a href="testDownload.php?file=c:\test.pdf">Download this file</a>
</BODY>
</HTML>
file - 2
<?
$dir="";
if (isset($_REQUEST["file"])) {
$file=$dir.$_REQUEST["file"];
header('WWW-Authenticate: NTLM', true);
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment;
filename=\"".basename($file)."\"");
readfile("$file");
} else {
echo "No file selected";
}
?>
Barry