I have been using a code set for a while now that has worked beautifully up until now. We recently added a file to our server that is supposed to be downloaded by the user using the Header php function. This function works for EVERY other file but this one. When the user downloads this one file, it comes out 2 bytes larger than the original and the executable won't run. If I use FTP and download it to my computer it works just fine.
Here is the code I am using:
$partd = fread(fopen("path/to/filename","r"), filesize("path/to/filename"));
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=$filename");
Header( "Content-Description: PHP3 Generated Data" );
echo ($partd);
The original file size is: 3,786,811 bytes. When it is downloaded using the above script, it comes out to be 3,786,813 bytes.
Any ideas?
Thank you,
Andrew