File (MIME) Types

Servers add a header to each document that tells the browser the type of file it is sending. The browser determines how to handle the file based on that information—whether to display the contents in the window, or to launch the appropriate plug-in or helper application.

The system for communicating media types closely resembles MIME (Multipurpose Internet Mail Extension), which was originally developed for sending attachments in email. The server needs to be configured to recognize each MIME type in order to successfully communicate the media type to the browser.

If you want to deliver media beyond the standard HTML files and graphics (such as a Shockwave Flash movie or an audio file), you should contact your server administrator to be sure the server is configured to support that MIME type. Most common formats are built in to current versions of server software, but if the format isn’t there already, the administrator can easily set it up if you provide the necessary information.

The exact syntax for configuring MIME types varies among server software; however, they all require the same basic information: type, subtype, and extension. Types are the most broad categories for files. They include text, image, audio, video, application, etc. Within each category are a number of subtypes. For instance, the file type image includes the subtypes gif , jpeg, etc. The extension refers to the file’s suffix, which the server uses to determine the file type and subtype. Not all extensions are standardized.

Table 4-1 lists common media types by extension along with their MIME type/subtype information. The ASCII/Binary information is provided to aid in making upload decisions.

Of course, new technologies and file types are emerging every day, so keep in mind that it is the web designer’s responsibility to make sure that for any new media type the appropriate information is communicated to the server administrator.

Table 4-1. MIME types and subtypes by extension

Extension

Type/Subtype

Description

ASCII/Binary

.ai

application/postscript

PostScript viewer

A

.aif, .aiff

audio/x-aiff

AIFF file

B

.aifc

audio/aifc

Compressed AIFF file

B

.au

audio/basic

μ-law sound file

B

.avi

video/avi or video/x-msvideo

AVI video file

B

.bmp

image/x-MS-bmp

Microsoft BMP file

B

.dcr, .dir, .dxr

application/x-director

Shockwave files

B

.doc, .dot

application/msword

Microsoft Word document

B

.eps

application/postscript

Encapsulated PostScript

A

.exe

application/x-msdownload

Self-extracting file or executable

B

.gif

image/gif

Graphic in GIF format

B

.gz, .gzip

application/x-gzip

Compressed file, use gunzip (Unix decompressor)

B

.hqx

application/mac-binhex40

Mac BinHex Archive

B

.htm

text/html

HTML document

A

.jpg, .jpeg, .jpe, .jfif, .pjpeg, .pjp

image/jpeg

Graphic in JPEG format

B

.mid

audio/midi or audio/x-midi

MIDI audio file

B

.mov

video/quicktime

QuickTime movie

B

.movie

video/x-sgi-movie

Silicon Graphics movie

B

.mpg, .mpe, .mpeg, .m1v, .mp2, .mp3, .mpa

video/mpeg

MPEG movie

B

.pbm

image/x-portable-bitmap

Portable bitmap image

B

.pcd

image/x-photo-cd

Kodak photo CD image

B

.pdf

application/pdf

Portable Document Format (Acrobat file)

B

.pic

image/x-pict

PICT image file

B

.pl

application/x-perl

Perl source file

A

.png

image/x-png

Graphic in PNG format

B

.ppt, .pot

application/powerpoint

PowerPoint file

B

.ps

application/postscript

PostScript file

A

.qt

video/quicktime

QuickTime movie

B

.ra, .ram

audio/x-pn-realaudio

RealAudio file (and metafile)

B

.rtx

text/richtext

Rich Text Format (Microsoft Word)

A

.rtf

application/rtf

Rich Text Format (MSWord)

A

.sea

application/x-sea

Self-extracting Archive (Stuffit file)

B

.sit

application/x-sit

Stuffit Archive

B

.snd

audio/basic

Digitized sound file

B

.swf

application/x-shockwave-flash

Shockwave Flash file

B

.tar

application/x-tar

Compressed file

B

.tif, .tiff

image/tiff

TIFF image (requires external viewer)

B

.txt

text/plain

ASCII text file

A

.wav

audio/s-wav

Waveform audio file

B

.wrl, .wrz

x-world/x-vrml

VRML 3D file (requires VRML viewer)

B

.xll, .xls

application/vnd.ms-excel

Microsoft Excel File

B

.zip

application/x-zip-compressed

Compressed file (decompress using WinZip or Stuffit on Mac)

B

Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.