What is a MIME type?
MIME stands for "Multipurpose Internet Mail Extensions. It's a way of identifying files on the Internet according to their nature and format. For example, using the "Content-type" header value defined in a HTTP response, the browser can open the file with the proper extension/plugin.What is an Internet Media Type?
"Internet Media Type" is the same as a MIME type. MIME types were originally created for emails sent using the SMTP protocol. Nowadays, this standard is used in a lot of other protocols, hence the new naming convention "Internet Media Type".What is a Content-Type?
A "Content-type" is simply a header defined in many protocols, such as HTTP, that makes use of MIME types to specify the nature of the file currently being handled.What does a MIME type look like?
A MIME type is a string identifier composed of two parts: a "type" and a "subtype". The "type" refers to a logical grouping of many MIME types that are closely related to each other; it's no more than a high level category. "subtypes" are specific to one file type within the "type".For example, the MIME value "application/xml" is used for XML documents and specifies that the "xml" subtype belongs in the "application" type.
Why are some MIME subtypes prefixed with "x-"?
The "x-" prefix of a MIME subtype simply means that it's non-standard, i.e. not registered with the "Internet Assigned Numbers Authority" (IANA).Why are some MIME subtypes prefixed with "vnd"?
The "vnd" prefix means that the MIME value is vendor specific.How can I set the Content-type header of my files?
It depends on the programming language you are using. Note that most language have a default "Content-type" of "text/html".-
Setting the Content-type in ASP:
<% response.ContentType="text/html" %> -
Setting the Content-type in C#:
// Response is of type System.Web.HttpResponse
response.ContentType = "text/plain"; -
Setting the Content-type in Java:
// Response is of type javax.servlet.ServletReponse
response.setContentType("text/plain"); -
Setting the Content-type in Perl/CGI:
print "Content-type:text/html"; -
Setting the Content-type in PHP:
<?php header('Content-type: text/html');?>
No comments:
Post a Comment