|
Posted by AnrDaemon on July 10, 2008, 8:33 pm
Please log in for more thread options
Greetings, dino d..
In reply to Your message dated Thursday, July 10, 2008, 23:00:42,
> I have a restricted download I want to set up. It's about 19 megs.
> It downloads fine, but it mysteriously adds 2 extra bytes to the
> file. If I grab the file directly via ftp, it's fine, so I know the
> file is good. I don't want to put the download in a public place
> because I need to track who is downloading when. Here's the code:
> function StartDownload()
> {
> $file='/products/demo/demo_installer.exe';
> $filename='demo-installer.exe';
> $fp = fopen($file, "rb");
> header('Content-type: Application/Octet-Stream');
> header('Content-Disposition: attachment; filename="demo-
> installer.exe"');
> header('Content-Encoding: none');
> //readfile($file); //have tried this too,
> fpassthru($fp);
> fclose($fp);
> }
> Any ideas why this doesn't work and how to fix it?
> I read somewhere else that http compression may be the culprit, but I
> don't know if it's possible to turn off compression in the code
> itself.
I'm sure it is not your code, but the file where you have it placed.
Check it for any additional line breaks. Or better, remove anything before
"<?php" or after "?>", even linefeeds.
And I think that "header('Content-Encoding: none');" is worthless.
--
|