• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Help getting Warning: Cannot modify header information - headers already sent by

kevx25

New Member
Hi,

I have some problems with a script I'm working on. The purpose of the script is to launch a download of a specific file, but the problem is the script won't work and i'm getting these error messages.
Warning: Cannot modify header information - headers already sent by

Code:
<html>
<head>
<title>Verification</title>
</head>
<body bgcolor="#4B73AA">

<font face="Verdana" size="+1" color="#FFFFFF">
<?php 
$word=$_GET['word'];
$from=$_POST['from'];
$subject=$_POST['subject'];
$suggestion=$_POST['suggestion'];
$enter=$_POST['enter'];



if(strcmp ($word, "pass")==0)
{

//The filename is stored in the $produitFilename variable in my script (the only thing you need)
$produitFilename = "Multiple.doc";
// You need to specify the REAL path for your file and not the URL
$fullPath    = getcwd()."/download/".$produitFilename;
if ($fd = fopen ($fullPath, "rb")) {
   $fsize    =filesize($fullPath);
   $fname    = basename ($fullPath);

   header("Pragma: ");
   header("Cache-Control: ");
   header("Content-type: application/octet-stream");
   header("Content-Disposition: attachment; filename=\"".$fname."\"");
   header("Content-length: $fsize");

   fpassthru($fd);


}


}
	else 
	{ echo "Sorry Your password is incorrect <br>";
	
	}

	?>
</font>
</body>
</html>
 
Back
Top