multipart/alternative

All MIME types
Multipart · Standards tree · RFC 2046header only

Media type / multipart

multipart/alternative

The same content in several representations, best last — the mechanism behind an email carrying both plain text and HTML.

Served inline: Browsers have no renderer for this, so it downloads even without a Content-Disposition header. That makes it the quiet default for anything you do not want opened in place.

Browser behaviour

Downloads

Charset

no charset

Compression

Already compressed

Send it like this

Content-Type: multipart/alternative

A binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.

Handling verdict

InlineDownloads

Browsers have no renderer for this, so it downloads even without a Content-Disposition header. That makes it the quiet default for anything you do not want opened in place.

Charsetno charset

A binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.

CompressionAlready compressed

The format compresses internally. Another transport encoding costs CPU on both ends and typically changes the size by less than a percent — sometimes upward.

NameStandards tree

Registered with IANA through a public review process, so the name is stable and every implementation can rely on it meaning the same thing.

Anatomy of the name

RFC 6838

Top-level type

multipart

Multipart

Subtype

alternative

Registered in the standards tree.

Structured syntax

none

No suffix, so the payload format is defined entirely by the subtype itself.

Parameters

boundary

Defined for this type in addition to any charset rule above.

What trips people up

1 note
  • Order is significant: the client picks the last part it can render, so the plain-text alternative goes first.

Response headers

Content-Type: multipart/alternative
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename="example"

nosniff stops the browser second-guessing the type you declared, which is what makes the rest of this reliable. Content-Disposition: attachment names the saved file and removes any doubt about rendering.

Server configuration

route header

nginx

# multipart/alternative has no file extension — set it on the route instead
add_header Content-Type "multipart/alternative";

Apache

# multipart/alternative has no file extension — set it on the handler instead
Header set Content-Type "multipart/alternative"

Caddy

header Content-Type "multipart/alternative"

Related media types

3
Familymultipart
Treestandards
Suffix
Inlinedownload