In judging the suffix name and file type is consistent, need to solve two problems, one is how to judge the file content according to the file Mine-type, this can use the system comes with the Magic Library implementation, and the second is how to judge the corresponding Mine-type according to the suffix name, The problem is that Apache also gives a solution, providing a comparison table of suffix names and mine-type.
However, there is a difference between the mine-type provided by Apache and the Mine-type provided by the system's own magic library, while the Python Magic Library provides a comparison table with the Mine-type provided by the Magic Library, and the common suffix is basically cover. Therefore, the use of Python suffix and mine-type table-based, adding the other table to form a custom suffix and mine-type table.
If there is a specific suffix that needs to be added, you can also use the Python script I provided to reorder them together.
The list in the attachments incorporates the suffix-meme-type list provided by Python mimetypes and a list of the following URLs:
Http://webdesign.about.com/od/multimedia/a/mime-types-by-file-extension.htm
This article is from the "7499511" blog, please be sure to keep this source http://7509511.blog.51cto.com/7499511/1768553
File name extension (suffix) vs. Mine-type