5

Can someone explain to me what's the difference between Content-Type and the MIME Type? I can't find a clear answer on the net.

If Content-Type usually used inside the Browser. And MIME type is used by the os?

user1187968
  • 7,154
  • 16
  • 81
  • 152

3 Answers3

4

In Content-Type=text/plain, Content-Type is a MIME header, text/plain is MIME Type.

Here are more MIME Headers (https://msdn.microsoft.com/en-us/library/ms526943(v=exchg.10).aspx):

MIME-Version
Content-Type
Content-Transfer-Encoding
Content-ID
Content-Description
Content-Disposition

Here are more MIME Types (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types. ):

text/plain
text/html
image/jpeg
image/png
audio/mpeg
audio/ogg
audio/*
video/mp4

More, you can specify an encoding for Content-Type

text/html; charset=UTF-8
user1187968
  • 7,154
  • 16
  • 81
  • 152
3

The Content-Type indicates the media type, where media types are defined as MIME types.

Content Type in RFC 7231

The "Content-Type" header field indicates the media type of the associated representation: [...] Content-Type = media-type

Media Type in RFC 7231

HTTP uses Internet media types [RFC2046] in the Content-Type (Section 3.1.1.5) and Accept (Section 5.3.2) header fields in order to provide open and extensible data typing and type negotiation.

Where RFC 2046 specifies MIME Types.

Community
  • 1
  • 1
sn42
  • 2,353
  • 1
  • 15
  • 27
  • 1
    I still don't get it, can you give an example. thanks! – user1187968 Feb 08 '18 at 19:09
  • 1
    [This answer](https://stackoverflow.com/a/3452833/8089107) may clarify it a bit. As far as i understand, `Content-Type` is a MIME header whose value is a mime type. If you send a HTTP request to get an image for example, your response headers contain a header `content-type` with the value `image/png`. The value is the MIME-type. – sn42 Feb 08 '18 at 22:37
0

MIME (Multipurpose Internet Mail Extensions)

MIME was originally designed to solve problems encountered in moving messages between different electronic mail systems.

Content-type

Header value defined in a HTTP response, the browser can open the file with the proper extension/plugin.

Example:Content-type: image/jpeg

This format is inspired form MIME format.

Content-type: main_mime_type(image)/mime_subtype(jpeg)

or HTTP adopted it to describe and label its own multimedia content.

Outside from question: MIME sniffing:-is used by some web browsers, in an attempt to help web sites which do not correctly signal the MIME type of web content display.

Rince Mathew
  • 27
  • 1
  • 6