I am trying to figure out how to use the header function. I want to enable users to download files. I keep getting errors when I try to use the function.
Here is my code:
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
Here is an example of the errors I am getting:
Warning: Cannot add header information - headers already sent by (output started at /Users/cbossen/Sites/download/download.php:1) in /Users/cbossen/Sites/download/download.php on line 13
Any help would be much appreciated...