Header / download
jeg har en fil hvor jeg gerne vil have at nå man trykker på et link så downloader den selve filenser sådan her ud
<?
if($download) {
$file = basename($PHP_SELF);
header( \"Content-type: application/x-gzip\" );
header( \"Content-Disposition: attachment; filename=$file\" );
header( \"Content-Description: PHP3 Generated Data\" );
}
?>
<a href=\"<? print\"$PHP_SELF?download=true\"; ?>\">download</a>
jeg får denne error
Warning: Cannot add header information - headers already sent by (output started at /test.php:4) in /test.php on line 5
Warning: Cannot add header information - headers already sent by (output started at /test.php:4) in /test.php on line 6
Warning: Cannot add header information - headers already sent by (output started at /test.php:4) in /test.php on line 7
/
altså i alle header linierne hvordan laver jeg det uden at skulle lave det i 2 filer?