MIME Types
Multipurpose Internet Mail Extensions
MIME types are used by web servers and web browsers. Each will contain a
file that has a table of MIME types with the associated file extension for
that type.
MIME type file on Apache
text/html html htm HTML
text/plain txt
image/gif gif
image/jpeg jpg jpeg
...
MIME types are universal
It is the MIME type that is universal, not the extension. All systems have
agreed to use MIME types to identify the content of a file transmitted over
the web. File extensions are too limiting for this purpose. Many different
word processor programs might use the extension .doc to identify a
file. For instance, .doc might refer to a MS WORD document or to a
MS WORDPAD document. It is impossible to tell from the extension which program
actually created the program. In addition, other programs could use the .doc
extension to identify a program: for instance, Word Perfect could also
use the .doc extension. Using the extension would be too confusing
to identify the content of the file.
By using a mime type, more information can be conveiged than in an extension.
There are two parts to a MIME type: the general category, and the specific
type. There can be several specific types in a category: image/gif, image/jpeg,
image/png.
When a file is sent over the internet, it's content is identified by a content
type.
Examples of using MIME types
Click on these links to see the message you get for these files:
-
junk.hdf You will most likely see a dialog box like
the one on the right. There is a radio list of options for handling this type
of file. There is also a checkbox to indicate that this action should always
be chosen.
Notice that the option for saving it to disk is chosen, since the
browser doesn't know what to do with this Mime type.
This is the process that occurred.
-
The browser requested the file junk.hdf from the server.
-
The server looked up the file extension in it's MIME types file, finding
a reference like this
application/x-hdf hdf
-
The server sends the file to the browser, identifying it's content as
application/x-hdf
-
The browser receives the file, looks in it's MIME types file, but does not
have an entry for application/x-hdf, so the browser queries the user
to determine what to do with the file.
-
junk.doc You will probably see a dialog box like the
one on the right, unless you have the browser automatically open the application
to view this file.
Notice that the option for opening with the default application is checked.
This is the process that occurred.
-
The browser requested the file junk.doc from the server.
-
The server looked up the file extension in it's MIME types file, finding
a reference like this
application/msword doc
-
The server sends the file to the browser, identifying it's content as
application/msword
-
The browser receives the file, looks in it's MIME types file and finds that
application/msword has been associated with the Word program
on my system.
-
junk.foobar This file has an extension that the
server does not recognize, so the default MIME type of text/plain
is sent to the browser. The browser is able to display this, so you will
see it in the browser window.
This is the process that occurred
-
The browser requested the file junk.foobar from the server.
-
The server looked up the file extension in it's MIME types file, but didn't
find an entry for the foobar extension. So, the server identifies
the file as text/plain, since that is the default type that was set
in the server's configuration file.
-
The server sends the file to the browser, identifying it's content as
text/plain.
-
The browser receives the file, looks in it's MIME types file, and sees that
text/plain can be handled by the browser, so the contents of the file
are displayed.
For more MIME information, check this link:
http://www.oac.uci.edu/indiv/ehood/MIME/MIME.html
For a list of mime types, check this link:
ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types