Access Keys:
Skip to content (Access Key - 0)

Q: How do I change the MIME type of a file served by


Web servers maintain a mapping of file extensions (e.g. .txt, .zip, .jpg) to MIME types. When you download a file or view a document on the web, the web server sends the MIME type, which tells your web browser how to handle the file. For example, your web browser knows that it can display JPEG images, plain text, or HTML files, but that if it receives a .zip file, it should instead offer to save it locally on your computer.

Sometimes, the web server cannot determine the type of a file (such as when a new file type is introduced with a new product), and it must instead guess how to server the file. Occasionally, may guess incorrectly, and will default to the MIME type text/plain for unknown files. When this happens, instead of downloading a file, your browser window may fill up with nonsensical symbols and letters.

You can force to serve the file a certain way based on the file's extension. (If the file does not have an extension, you must assign it one.) This is done in the file, with the {[AddType}} directive:

AddType mime/type extension

The mime/type must either be the registered MIME type for the file, or application/octet-stream which tells the web server to serve the file as binary data, thereby directing most web browsers to save the file locally. extension is not limited to three characters e.g., if your custom program creates files with the extension ".xyz", you could force them to be served as binary data with the following in your file:

AddType application/octet-stream xyz

IS&T Contributions

Documentation and information provided by IS&T staff members

Last Modified:

November 01, 2013

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
webmitedu webmitedu Delete
cwis cwis Delete
wcs wcs Delete
c-web-publishing c-web-publishing Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
This product/service is:
Easy to use
Difficult to use

This article is:
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki