Adding Different Media to Your Pages
Summary
This article outlines how to incorporate uncommon media types onto your Web site, and gives a brief introduction to MIME types. For specific information about streaming media formats like RealMedia, Windows Media, and "hinted" QuickTime Streaming movies, please refer to Streaming Media Services.
Included on this page:
- File Types Recognized by UW Technology's Web servers
- Introduction to MIME Types
- Introducing an Uncommon Media Type
File Types Recognized by UW Technology's Web Servers
The following table reveals the most common media types and their appropriate filename extensions:
| Media Type | Filename Extension |
|---|---|
| HTML | .html or .htm |
| GIF image | .gif |
| JPEG image | .jpg or .jpeg |
| Plain text | .txt |
| Microsoft Word document | .doc |
| Microsoft Excel spreadsheet | .xls |
| Microsoft PowerPoint presentation | .ppt |
| Quicktime movie (FastStart) | .mov |
Introduction to MIME Types
A file's extension determines how a Web browser handles your media. A Web server responds to a request for a file by looking up its filename extension in a table to find what is called its MIME type. MIME (Multi-purpose Internet Mail Extension) types allow web servers and browsers to transfer files of the same type in the same way, no matter what operating system they are working in. The importance of finding the right MIME type is crucial because it--and not the filename--determines whether the file is displayed, saved, or handed off to a plug-in by the Web browser.
If you use a filename extension that is not known to the Web server, the file is assumed to be plain text, the server's default media type. Web browsers will try to display the file as plain text. If the file is not a text file, it may end up looking like a sequence of garbage characters.
Introducing an Uncommon Media Type
If you introduce a media type that isn't well known then you have to tell the Web server how to serve it up.
-
First, determine the MIME type associated with your media type. You might have to hunt for it, perhaps by visiting Web sites that cater to the media type. Such sites often reveal the registered (or defacto) MIME type.
Tip: A MIME type has two parts: a type and a subtype. They are separated by a slash (/). For example, the MIME type for Microsoft Word files is application and the subtype is msword. Together, the complete MIME type is application/msword.
-
Now log in to your Homer, Dante, or Shell.MyUW.net account.
-
Press the O key for Other, then press the W key to drop into the Web development environment.
-
At the prompt, enter the following command to change directories to your Web directory:
cd public_html
If your new media files are in a subdirectory, change directories to the subdirectory. For example:
cd sounds
-
At the prompt, enter the following command to create a .htaccess file in the current working directory:
pico .htaccess
-
Add the following text to this file:
AddType <mimetype> <extension>
Replace <mimetype> with the appropriate MIME type and <extension> with the filename extension you're using to represent it.
For example, the following line maps the "audio/midi" MIME type to the .mid filename extension:
AddType audio/midi mid
-
Save the .htaccess file (in Pico use ^X).
-
You're done! Check to see that it works with your Web browser.
