File Type Detection Apache Tika
Apache Tika is a useful open source library written in Java for detecting file types. Most people use it to validate files they accept, such as through a web interface. This is useful for security, since any file extension can be assigned to any file. Only through content inspection can you be sure of a file’s real type.