Try looking here:
You might be able to:
1. Open your file in "binary" mode
2. Use the string "pack()" and "unpack()" functions to copy the binary data
into/out of your PHP file I/O functions.
3. Use "$s = fread (int fp, int length)" and "fwrite (int fp, string $s, int length)" to do the actual I/O.
Just a thought .. PSM