Hi,
I'm trying to make a zip file accessible only via fpassthru for validated users.
Unfortunately, an extra byte (newline I think) is always added to the start of the file.
(If I include the length of the file in the header then the last byte is consequently lost.)
I've tried changing the headers in various ways, using things that seem to have worked for others, but to no avail.
Has anyone any ideas?
Thanks,
Michael
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/save");
header("Content-Disposition: attachment; filename=$file", "zip");
//header("Content-Length: " . filesize($pathtofile));
//header("Content-Transfer-Encoding: binary");
// dump the file and stop the script
$fp = fopen($pathtofile, 'rb');
fpassthru($fp);
fclose($fp);
exit;