I want to validate a type of an uploaded file (suppose the file has incorrect extension).
I figure it could be done by checking the magic number of file signature. Similarly, as it is done in unix. So I guess I need to read the first bytes of the file and compare them with the magic number mappings (and I need to have the mappings and I need to maintain them).
So I thought maybe there is a class out there just for this purpose? Or maybe someone has done this and can share their insights on the solution? Thanks