note 63998 added to function.header
| From: | Barry at osu1 dot php dot net | Date: | Wed, 05 Apr 2006 06:44:54 +0000 |
| Subject: | note 63998 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107361@lists.php.net to get a copy of this message | ||
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
----
Server IP: 203.199.107.94
Probable Submitter: 59.182.95.143
----
X-Spam-Status: No, hits=4.0 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_50_60,HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/note/edit/63998
Del: integrated -- http://master.php.net/note/delete/63998/integrated
Del: useless -- http://master.php.net/note/delete/63998/useless
Del: bad code -- http://master.php.net/note/delete/63998/bad+code
Del: spam -- http://master.php.net/note/delete/63998/spam
Del: non-english -- http://master.php.net/note/delete/63998/non-english
Del: in docs -- http://master.php.net/note/delete/63998/in+docs
Del: other reasons-- http://master.php.net/note/delete/63998
Reject -- http://master.php.net/note/reject/63998
Search -- http://master.php.net/manage/user-notes.php