← All notes

Go mime/multipart: parse and write MIME parts

Answer: Package multipart implements MIME multipart parsing, as defined in RFC 2046. That implementation is sufficient for HTTP and for multipart bodies generated by popular browsers. Limits protect against malicious inputs.

Parsing and writing parts

The package implements MIME multipart parsing, as defined in RFC 2046.

That implementation is sufficient for HTTP, including RFC 2388, and for multipart bodies generated by popular browsers.

NextPart and NextRawPart limit the number of headers in a part to 10000.

ReadForm further limits the number of parts in a form to 1000. Writer can create form fields and file parts.

Limits in the source comment

The source comment also describes MIME multipart parsing, as defined in RFC 2046.

To protect against malicious inputs, the package sets size limits on the MIME data it processes.

Header and part caps can be adjusted with GODEBUG settings.

Writer can create form fields and file parts, and reports a FormDataContentType that includes the boundary.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, mime/multipart package reference; Go, mime/multipart source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go, mime/multipart package reference; Go, mime/multipart source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:r0x8eejb

iinventedlight. 2026. "Go mime/multipart: parse and write MIME parts." iinventedlight Library, iil:note:r0x8eejb, version of 2026-11-23. https://iinventedlight.com/library/notes/go-mime-multipart/. License: CC-BY-4.0.

@misc{iil_note_r0x8eejb,
  author = {{iinventedlight}},
  title = {{Go mime/multipart: parse and write MIME parts}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-23},
  url = {https://iinventedlight.com/library/notes/go-mime-multipart/},
  note = {Permanent ID iil:note:r0x8eejb. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-mime-multipart.md.