Forum Moderators: coopster
The code I'm currently using:
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($filename);
header("Content-Disposition: attachment; filename=\"".$filename."\"");
$handle = fopen(realpath($filename),"r");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
print($buffer);
}
fclose($handle);
exit;
Anyone got an idea how to solve this?
Thanks in advance,
David
I'm pretty sure that's not PHP doing that; it would have no reason to modify whatever the value of $filename was in your script.
Sticking [1] on the end of filenames sounds like the sort of thing the downloading browser / operating system would do when asked to download a file of the same name as one already on the disk. Have you checked that this is not the case...?