Associating file types with programs
Associating file types with programs
The most common use of the MIME Types file is to associate file types with programs. The standard length for both the Macintosh file type and Macintosh file creator names is four characters. If you have less than four characters, you must use double quotes ("") around the entry and put spaces in for missing characters (for example, "mp3 ").
If no MIMETypes data is available, Internet Services maps the filename extension to the equivalent Macintosh file type/file creator values based on a FILETYPES record. FILETYPES is a built-in table of well-known extensions, file type and creator information, and icon ids. This is a fallback facility if the information is not found in the MIME Types document.
Associating icons with attachments
The FILETYPES table contains the default icon id to use for many file extensions. You can override this default by adding a new icon id to the end of the associated line in the MIME Types document.
For example, if you prefer to associate Microsoft Word documents with icon id 1234 instead of the default 9620, you can edit the associated line in the MIME Types document as follows:
application/msword W6BN MSWD .doc 1234
MIME Types file syntax
The basic MIME type syntax is:
mime type/subtype<tab>Mac type<tab>Mac creator<tab>filename extension [<tab>attachment icon id]
where,
mime type is the type of file
subtype is the subtype of the file
<tab> is a space
Mac type is the Macintosh file type
Mac creator is the browser type
filename extension is the extension of the file
attachment icon id is the icon id to associate with this file type if you wish to override the default icon id. Optional.
In keeping with the above syntax, a standard MIME type entry might be:
text/html<tab>TEXT<tab>MSIE<tab>.html
This entry causes all files with a .html extension to be sent to the browser directly.
For video files, you could enter this line of code in the MIME Types file:
video/mpeg MPEG mMPG .mpeg
This entry causes all files with a .mpeg extension to be sent to the browser directly.
Although it is a good idea to put entries in for each variable in the MIME type syntax, the most important entries are the mime type, subtype, and filename extension. These entries must be entered for the MIME type code to work. You can enter question marks (?) for the Mac type and Mac creator variables, for example:
audio/basic ???? ???? .snd
where this entry specifies a basic audio file with the .snd extension, and both Mac type and Mac creator can be anything, as designated by the question mark (?).
Although there are many predefined MIME Types, such as GIF graphics files and PostScript files, you can also define your own, by adding a line for each in the MIME Types file. Some commonly used file extensions are:
• .shtml, .shtm, .shm, .inc
• .swm, .swmls, .wml
• .png, .pict, .bmp
• .txt
• .css.
|