I am trying to build a download function using headers... but I guess I don't understand them well enough. What is wrong with this code?
function download ($file) {
if (isset ($file)) {
header ("Content-type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$file");
header ("Content-Transfer-Encoding: binary");
$fileData = fopen ("$file" , "rb");
fpassthru ($fileData);
}
}
I get errors that it can't add header information...
Help!
Thanks,
Chad