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
- id: C1 claim: The package implements MIME multipart parsing as defined in RFC 2046. source: S1 evidence: "MIME multipart parsing, as defined in RFC 2046"
- id: C2 claim: The implementation is sufficient for HTTP and common browser bodies. source: S1 evidence: "sufficient for HTTP ( RFC 2388 )"
- id: C3 claim: The source comment describes MIME multipart parsing as defined in RFC 2046. source: S2 evidence: "Package multipart implements MIME multipart parsing, as defined in RFC"
- id: C4 claim: Limits exist to protect against malicious inputs. source: S2 evidence: "To protect against malicious inputs"
Sources
- [S1] mime/multipart package reference. Go. https://pkg.go.dev/mime/multipart . License: BSD-3-Clause. Accessed 2026-11-23.
- [S2] mime/multipart source. Go. https://go.dev/src/mime/multipart/multipart.go . License: BSD-3-Clause. Accessed 2026-11-23.
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
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.},
}
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.
- go-mime-multipart.schema.json (schema; CC-BY-4.0)
- go-mime-multipart.table.json (table; CC-BY-4.0)
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.