A wild guess:
PHP Code:
//header("Content-Transfer-Encoding: binary");
maybe it should have been
PHP Code:
header("Content-Transfer-Encoding: binary");
From php.net:
Quote:
The default translation mode depends on the SAPI and version of PHP that you are using, so you are encouraged to always specify the appropriate flag for portability reasons. You should use the 't' mode if you are working with plain-text files and you use \n to delimit your line endings in your script, but expect your files to be readable with applications such as notepad. You should use the 'b' in all other cases.
If you do not specify the 'b' flag when working with binary files, you may experience strange problems with your data, including broken image files and strange problems with \r\n characters.
For portability, it is strongly recommended that you always use the 'b' flag when opening files with fopen(). |
So the opening of the file should be:
PHP Code:
$fh = fopen("$file", "rb");