Treat the filename as an untrusted suggestion
04A response cannot grant permission to write outside authorized locations. Filename paths, extensions, controls and special names need recipient-side handling.
For a text/plain example, the surrounding spaces are removed from " .. ", exposing a special name. The shown recipient follows SHOULD and substitutes download.txt; no actual file write is implied.
Source for this drawing: RFC 6266 · Read RFC section 4.3 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
An advisory filename is neither a trusted path nor a file-safety verdict.
- Recipients MUST NOT be able to write anywhere they are not specifically entitled. One strategy is to discard all but the last path segment, considering both slash and backslash separators; this is a strategy, not a mandated complete sanitizer.
- Recipients that use file extensions to determine media type MUST ensure a safe extension, optimally matching the received media type. A server-supplied .exe is not authority to execute, and renaming does not validate the file contents.
- Recipients SHOULD strip or replace confusing sequences such as control characters and surrounding whitespace, and SHOULD ignore or substitute special names such as . or .., ~, | and device names.
Three independent fictional examples; no real file is written or executed. Stripping paths does not grant permission to overwrite the remaining basename. A substitute download.txt is only a chosen example for a text/plain payload, not the required name or extension for all downloads. Other local safety policy still applies.
Read the RFC section ↗