KMatle Expert Licensed User Longtime User Nov 26, 2020 #1 I'm developing a mail importer and would like to check the mime type of a file without trusting the file extension. Is there a simple way to do this?
I'm developing a mail importer and would like to check the mime type of a file without trusting the file extension. Is there a simple way to do this?
Andrew (Digitwell) Well-Known Member Licensed User Longtime User Nov 26, 2020 #2 Depends on your definition of simple. There is this GitHub project which identifies quite a range of filetypes by file signature header bytes. GitHub - Tinram/File-Identifier: Identify a file via MIME type and file signature detection. Identify a file via MIME type and file signature detection. - Tinram/File-Identifier github.com It is in PHP, but could be converted. Seems to cover 60 different file types. Upvote 0
Depends on your definition of simple. There is this GitHub project which identifies quite a range of filetypes by file signature header bytes. GitHub - Tinram/File-Identifier: Identify a file via MIME type and file signature detection. Identify a file via MIME type and file signature detection. - Tinram/File-Identifier github.com It is in PHP, but could be converted. Seems to cover 60 different file types.