I write a simple php to load some binary data from DB then output to client.
$sql="select FightPlayEnd from ZMTXLogic.FightLog where ID=".addslashes($id);
$result=$db->query($sql);
if($db->num_rows($result)>0)
{
$row = mysql_fetch_assoc($result);
$nByteCount = mb_strlen($row["FightPlayEnd"], '8bit');
//echo $nByteCount;
header("Content-type:application/octet-stream");
header("Accept-Ranges:bytes");
header("Accept-Length:".$nByteCount);
header("Content-Disposition:attachment;filename=FightPlayEnd.bin");
header( "Content-type: application/octet-stream");
echo $row["FightPlayEnd"];
}
The problem is the data got from IE is not same as original binary data but added EF BB BF(view in UltraEdit) at the header and 0D 0A 0D 0A at the end. What is wrong with it?