in reply to Opinions on determining mime type
File::MMagic works exactly like the 'file' Unix command. It uses a "magic" file that has identifying characteristics of tons of different file formats and can very accurately determine the type of file.
What I would do is give preference either to the browser's MIME type (if it's non-generic) or use something like File::MMagic (or perhaps both). Failing either of those, fall back to the extension and do some hard-coded mappings.
|
|---|