How can I read few bytes from posted data?
Posted: Fri Jul 11, 2008 8:45 am
Hi.
What I'm trying to do, is to read the file header, and than to decide what to do with it. E.g. if it says it's 3 first bytes are \xEF \xBB \xBF, the script will treat it as if it was a UTF-8 encoded text, and if it's \x47 \x49 \x46, than it's a GIF image etc.
The problem is I'm receiving the file via $GLOBALS["HTTP_RAW_POST_DATA"], and I have no clue to how can I extract bytes from it...
Suggestions / manual links / tutorial will be much apprecated.
What I'm trying to do, is to read the file header, and than to decide what to do with it. E.g. if it says it's 3 first bytes are \xEF \xBB \xBF, the script will treat it as if it was a UTF-8 encoded text, and if it's \x47 \x49 \x46, than it's a GIF image etc.
The problem is I'm receiving the file via $GLOBALS["HTTP_RAW_POST_DATA"], and I have no clue to how can I extract bytes from it...
Suggestions / manual links / tutorial will be much apprecated.