Mime Types
- MIME was developed when email clients started to send files as attachments. By defining what type of file was attached, the receiving email program could look for a corresponding application to open the file. This is why, for example, MS Word opens when you receive a .doc file as an attachment. This has been expanded further so that both email programs and browsers can often open files inside their own windows. In addition, MIME types can be used for security; particular MIME types can be banned, moved to quarantine or checked to make sure they contain no hidden problems.
- A MIME type comes in two parts: a type and a subtype. Common types are application, audio and image. The mime type for MS Word is application/msword. This indicates that it is in application file (to be opened by an application) and that it is specifically for MS word. It is up to the receiving email or browser to provide an association with the program; most browsers and email programs come with this list built in, including the ability to add or modify which program to use. As an example, audio files can often be played by many different programs; these programs can modify the local list of MIME types to make themselves the default, if that is desire of the user.
- Subtypes can have optional parameters sent with them. The subtype of "text" will allow a parameter of "charset" to be sent. There are many character sets for text files; by specifying the character set, the receiving application knows which of these to use. For example, HTML, the formatted text of a web page, normally uses the UTF-8 character set; this MIME type is sent as "text/html; charset=UTF-8."
- It is possible to create custom MIME types. When building a web application there is often a need to trigger an event by sending a file through email, via a web browser or by retrieving it with a program. Creating a MIME type -- or several MIME types -- to handle this is simply a matter of defining the file and adding the MIME type to the list in the email and browser programs handling it (or to the list on the web server running the receiving program). Most web programming languages, such as Java and PHP, provide ways to detect MIME types, and this information can then be used to decide how to process the file.
Purpose of MIME
The MIME Naming Standard
MIME Subtype Parameters
Custom MIME Types
Source...