FTP File Types, Transmission Modes, Connections, and STOR vs RETR
FTP (File Transfer Protocol) can transfer any file as “bytes,” but FTP also provides transfer types that determine how the bytes are interpreted (and sometimes transformed) between the client and server. Commonly, clients choose between ASCII (text with newline/format conversion) and Image/Binary (raw bytes, no conversion). This matches how FTP “data representation” works: text can be converted between character representations, while binary is stored/forwarded byte-for-byte. 3
In addition, FTP’s data transfer is governed by three transmission modes: Stream, Block, and Compressed. These modes define how FTP structures the data and how it signals end-of-file/record conditions on the data connection. 2
Key terms:
- FTP transmission mode
- FTP transfer type
- Control connection
- Data connection
- STOR
- RETR
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩ ↩2
-
File Transfer Protocol - Wikipedia - Describes ASCII vs Image (binary) and notes ASCII is for text and includes conversions. ↩
-
FileZilla Pro docs: FTP File Transfer Modes: ASCII vs Binary - Explains ASCII for text and binary for images/data; warns about misclassification. ↩
-
RFC 959: File Transfer Protocol data transfer functions (3.4/Transmission Modes) - Describes stream mode and references block/compressed modes. ↩
What kinds of file types can FTP transfer?
FTP implementations can transfer many kinds of files (text, images, archives, executables, etc.), but at the protocol level the important distinction is transfer type:
- ASCII transfer type (TYPE A): designed for text, where FTP may convert text and line endings between systems. FTP notes that ASCII is inappropriate for non-ASCII/binary data because of the representation conversions involved. 2
- Image/Binary transfer type (TYPE I / “binary mode”): sends bytes directly and is intended for “image” (raw binary) data such as images or other non-text formats. 3
Practically, that means:
- Text files (e.g.,
.txt,.html) → typically use ASCII for correct newline/character handling. - Non-text/binary files (e.g., images
.png, archives.zip, executables.exe) → typically use binary/image to avoid corruption from conversions.
Mermaid overview (conceptual):
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩ ↩2
-
File Transfer Protocol - Wikipedia - Describes ASCII vs Image (binary) and notes ASCII is for text and includes conversions. ↩ ↩2 ↩3
-
FileZilla Pro docs: FTP File Transfer Modes: ASCII vs Binary - Explains ASCII for text and binary for images/data; warns about misclassification. ↩ ↩2
The three FTP transmission modes (MODE)
FTP defines three transmission modes for data on the data connection: 2
- Stream mode (MODE S): data is sent as a continuous stream of bytes. End-of-file/record handling differs by file structure; for stream mode, EOF may be inferred from connection behavior, while record-structured transfers use control codes.
- Block mode (MODE B): data is sent in blocks (each with header/descriptor information), supporting features like restart and reliable parsing of boundaries.
- Compressed mode (MODE C): similar to block mode but includes compression (e.g., run-length encoding style), with framing/descriptor support so the receiver can parse the compressed stream.
These modes are distinct from active vs passive networking behavior; they are about how the bytes are framed and how EOF/EOR are represented to the receiver. 2
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩ ↩2 ↩3 ↩4 ↩5
-
RFC 959: File Transfer Protocol data transfer functions (3.4/Transmission Modes) - Describes stream mode and references block/compressed modes. ↩ ↩2
Describe the functions of the two FTP connections
FTP uses two separate TCP connections between client and server: 2
-
Control connection
- Purpose: carry FTP commands (e.g., login, listing, file transfer requests) and return status replies (numeric response codes). 2
- Typical flow: the client issues commands like “start transfer” and the server responds with statuses such as “ready/starting transfer/complete.”
-
Data connection
- Purpose: carry the actual file bytes (and directory listing contents during LIST-type operations). 2
- Typical flow: when a transfer begins, FTP opens a separate data connection for that operation; after data transfer, it closes (while the control connection usually remains).
Mermaid sequence (conceptual transfer):
Footnotes
-
File Transfer Protocol - Wikipedia (control vs data connections) - States FTP uses separate control and data connections and control replies carry status. ↩ ↩2 ↩3 ↩4
-
File Transfer Protocol (FTP) in Application Layer - GeeksforGeeks - Explains control channel for commands and data channel for file transfer (with separate ports concept). ↩ ↩2 ↩3 ↩4
Storing vs Retrieving: what changes in FTP?
- 1Step 1
The client issues STOR; the server accepts the incoming data on the data connection and writes it to a server-side path. If the file exists, its contents are replaced (per common FTP command behavior).
Footnotes
-
FTP commands: STOR (STORE) - Progress WS_FTP Server help - States STOR stores received data on the server and replaces if it exists. ↩
-
- 2Step 2
The server treats the incoming payload according to the negotiated TYPE and MODE (e.g., ASCII vs binary; stream vs block vs compressed). Framing/EOF handling is determined by MODE. 2
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩
-
RFC 959: File Transfer Protocol data transfer functions (3.4/Transmission Modes) - Describes stream mode and references block/compressed modes. ↩
-
- 3Step 3
The client issues RETR; the server sends a copy of the specified server file to the client via the data connection. This does not change the server’s copy.
Footnotes
-
FTP commands: RETR (RETRIEVE) - SolarWinds Serv-U tutorial - States RETR sends a copy of the file and does not affect the server copy. ↩
-
- 4Step 4
The server transmits the file bytes using the negotiated TYPE/MODE framing so the client can correctly reconstruct the received content and detect end-of-transfer. 2
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩
-
RFC 959: File Transfer Protocol data transfer functions (3.4/Transmission Modes) - Describes stream mode and references block/compressed modes. ↩
-
Rule of thumb for “file type” vs FTP settings
FTP may transfer “any file,” but correctness depends on matching the client’s FTP transfer type to the file content: use ASCII for text; use binary/Image for non-text to prevent unintended conversions. 3
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩
-
File Transfer Protocol - Wikipedia - Describes ASCII vs Image (binary) and notes ASCII is for text and includes conversions. ↩
-
FileZilla Pro docs: FTP File Transfer Modes: ASCII vs Binary - Explains ASCII for text and binary for images/data; warns about misclassification. ↩
Using the wrong transfer type can corrupt files
If a binary file is sent using ASCII/text handling, representation conversions and newline formatting can alter bytes and produce a corrupted download. FTP explicitly warns that ASCII is inappropriate for data other than ASCII.
Footnotes
-
RFC 765: File Transfer Protocol specification | RFC Editor - Defines FTP transmission modes (S/B/C) and transfer mode concepts (MODE/TYPE/STRU). ↩
FTP operations: STOR (upload) vs RETR (download)
What the data connection does, and how server content is affected
Common misunderstandings (FTP modes vs connections vs networking)
Knowledge Check
Which pair correctly matches FTP’s three transmission modes?