how to read the bytes that make up a file?
Posted: Tue May 10, 2005 10:02 am
Hello
I have a file which the user uploads
The file should be of type jpeg
I would like to ensure that the uploaded file has indeed the correct header format of jpeg: '\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46'
I need some way to read the first set of bytes that make up the file
and then to compare them to the correct header of
'\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46'
does anyone know how I can read these bytes and perform the comparison?
thanks in advance
I have a file which the user uploads
The file should be of type jpeg
I would like to ensure that the uploaded file has indeed the correct header format of jpeg: '\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46'
I need some way to read the first set of bytes that make up the file
and then to compare them to the correct header of
'\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46'
does anyone know how I can read these bytes and perform the comparison?
thanks in advance