Possible Duplicate:
Headers already sent by PHP
I am a begginner in php and I want to create an download button but I received an error that i don't understand. This is my error:
"Warning: Cannot modify header information - headers already sent by (output started at D:\Program Files\xampp\htdocs\FormsGenerator\index.php:125) in D:\Program Files\xampp\htdocs\FormsGenerator\download.php on line 11"
On 125 row I had open the tag for php to call the functions created. This is my cod for button functionality:
<?php
class fileDownload{
function fileDownload(){
$core_path = dirname(__FILE__);
$file_path = "{$core_path}/file/form.html";
$file_info = array(
'name' => basename($file_path),
'size' => filesize($file_path)
);
header('Content-Type: application/html');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="'.$file_info['name'].'"');
header('Content-Lenght: '.$file_info['size']);
$file = fopen($file_path, 'rb');
while(!feof($file)){
echo fread($file, 256);
}
fclose($file);
return;
}
}
?>
And here is the created object that calls the class:
if(isset($_GET['download'])){
include 'download.php';
$download = new fileDownload();
}
Can someone help me?