Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a little PHP file which is used for downloading files off the site. This little PHP file basicly just sets the correct headers and a readline statement like so:Code: Select all
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
@readfile("$filename");When this PHP file is used on a PHP4 enabled Apache server, all goes OK.
But, when it's used on a PHP5 enabled server the file that is downloaded is corrupted.
The file is 'corrupted' in the following way:
The file is 2 bytes bigger than originally. These 2 bytes in question are 0D 0A at the very beginning of the file (first 2 bytes thusly). I think that's a newline (or "\n").
I cannot change this 'corrupt' behaviour no matter what I try...
Can anyone offer my some insight? It's sorely needed
Thanks!
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]