I'm trying to get a pass through download script working.
Its basically based on all the ones I've found around the internet but it only half works.
At the moment I can use to for downloads of text files but pdf files get corupted.
Firefox recognises the file types and seems to get the file extensions half right but IE has no idea.
Basically the script gets handed an ID, this is looked up in a DB to find the real file name. Then this file is sent to the user.
$name = $dadir . $data['dafile_path'];
if ($fp = fopen($name, 'rb')) {
$fsize = filesize($name);
$fname = basename($name);
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$name ."\"");
header("Content-length: $fsize");
fpassthru($fd);
}
Thanks
Liaaam