You said the bytes are being sent correctly so the problem is in how PHP interprets them.

I guessed a zero byte because because that's a common side effect of treating binary as text. Your example is a JPEG mage. JPEG images start with the bytes 0xFF 0xD8 0xFF 0xE0 followed by two byte block length (big-end first) and the four letters JFIF etc. In the case the header block is small (usually) the fifth byte of the file will be 0. The characters you see are what I would expect if PHP were treating the bytes as characters encoded according to the ISO/IEC 8859-2:1999 (Latin-2) or Windows CP1250 (Eastern Europe) 8-bit encoding.