File (MIME) Types

Servers add a header to each document, which tells the browser the type of file it is sending. The browser determines how to handle the file based on that information—for example, 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 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 into 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, and so on. Within each category are a number of subtypes. For instance, the file type image includes the subtypes gif, jpeg, and the like. 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 the MIME type and subtype for common media types. 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. For a complete listing of registered MIME types, see the IANA (Internet Assigned Numbers Authority) site at http://www.iana.org/assignments/media-types/.

Table 4-1. MIME types and subtypes

Type/subtype

Extension

Description

ASCII/binary

application/excel

.xl

Microsoft Excel

B

application/mac-binhex40

.hqx

Mac BinHex archive

B

application/msword

.doc, .dot, .word,.w6w

Microsoft Word document

B

application/pdf

.pdf

Portable Document Format (Adobe Acrobat file)

B

application/postscript

.ai

PostScript viewer

A

application/postscript

.eps

Encapsulated PostScript

A

application/postscript

.ps

PostScript file

A

application/powerpoint

.ppt, .pot

PowerPoint file

B

application/rtf

.rtf

Rich Text Format (Microsoft Word)

A

application/vnd.ms-excel

.xll, .xls

Microsoft Excel File

B

application/xml

.xml

Generic XML

A

application/xml+xhtml

.htm, .html

XHTML document

A

application/x-director

.dcr, .dir, .dxr

Shockwave files

B

application/x-gzip

.gz, .gzip

GNU zip (Unix decompressor)

B

application/x-msdownload

.exe

Self-extracting file or executable

B

application/x-perl

.pl

Perl source file

A

application/x-sea

.sea

Self-extracting archive (StuffIt file)

B

application/x-sit

.sit

StuffIt archive

B

application/x-shockwave-flash

.swf

Shockwave Flash file

B

application/x-stuffit

.sit

StuffIt Archive

B

application/x-tar

.tar

Compressed file

B

application/x-zip or application/x-zip-compressed

.zip

Compressed file (decompress using WinZip or StuffIt on Mac)

B

audio/aifc

.aifc

Compressed AIFF file

B

audio/basic

.au

μ-law sound file

B

audio/basic

.snd

Digitized sound file

B

audio/midi or audio/x-midi

.mid

MIDI audio file

B

audio/x-aiff

.aif, .aiff

AIFF file

B

audio/x-mpeg

.mp3

MP3 audio file

B

audio/x-ms-wma

.wma

Windows Media audio file

B

audio/x-ms-wax

.wax

Windows Media audio metafile

B

audio/x-pn-realaudio

.ra, .ram

RealAudio file (and metafile)

B

audio/x-pn-realaudio-plugin

.rpm

RealAudio (plug-in)

B

audio/x-wav

.wav, .aiff

Windows WAV audio file

B

image/gif

.gif

Graphic in GIF format

B

image/jpeg

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

Graphic in JPEG format

B

image/tiff

.tif, .tiff

TIFF image (requires external viewer)

B

image/x-MS-bmp

.bmp

Microsoft BMP file

B

image/x-photo-cd

.pcd

Kodak Photo CD image

B

image/x-pict

.pic

PICT image file

B

image/x-png or image/png

.png

Graphic in PNG format

B

image/x-portable-bitmap

.pbm

Portable bitmap image

B

text/html

.htm

HTML document

A

text/plain

.txt

ASCII text file

A

text/richtext

.rtx

Rich Text Format (Microsoft Word)

A

text/xml

.xml

Generic XML document

A

video/avi or video/x-msvideo

.avi

AVI video file

B

video/mpeg

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

MPEG movie

B

video/quicktime

.mov

QuickTime movie

B

video/quicktime

.qt

QuickTime movie

B

video/x-ms-asf

.asf

Windows Media (legacy)

B

video/x-ms-asx

.asx

Windows Media metafile (legacy)

B

video/x-ms-wmv

.wmv

Windows Media video file

B

video/x-ms-wmx

.wmx

Windows Media video metafile

B

video/x-sgi-movie

.movie

Silicon Graphics movie

B

x-world/x-vrml

.wrl, .wrz

VRML 3D file (requires VRML viewer)

B

Get Web Design in a Nutshell, 3rd 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.