Sending most correct mimetype

Posted by Roland Franssen on Stack Overflow See other posts from Stack Overflow or by Roland Franssen
Published on 2010-05-08T09:03:54Z Indexed on 2010/05/08 9:08 UTC
Read the original article Hit count: 371

Filed under:
|

Hi all,

I have a list of extension to mimetype in a INI file. However some extensions have multiple mimetypes, for example;

midi[] = "application/x-midi"
midi[] = "audio/midi"
midi[] = "audio/x-mid"
midi[] = "audio/x-midi"
midi[] = "music/crescendo"
midi[] = "x-music/x-midi"

6 (possible) mimetypes for 1 extension. Whats common practice to determine the correct mimetype? (e.g. i need to set a HTTP content-type header).

I know its not ideal; determining mimetypes based on extension.. but i need consistent (cross-server) results (e.g. fileinfo extension in PHP is making terrible guesses*).

* Some fileinfo results for example;

  • js - text/plain
  • css - text/c-h

© Stack Overflow or respective owner

Related posts about mimetypes

Related posts about content-type