PHP Download script problems

Permabanned
Joined
25 Oct 2004
Posts
9,078
Without pasting my php code as its part of a much larger setup, im having trouble with downloaded items.

The script is basically there to keep track of all files downloaded from our site along with the ip address and date/time of the download, thing is when ever a file is downloaded, it becomes unusable and corrupted making the download pointless.

Code:
            header("Content-type: $type");
            header("Content-Transfer-Encoding: binary");
            header('Content-Disposition: attachment; filename='.$action);
            header('Content-Length: '.filesize($path));
            readfile($path);

Thats the code for sending the file to the user so should really work fine.

Any idea's why files would be corrupted ?
 
Back
Top Bottom