FTP ASCII vs. Binary transfer modes

FTP ASCII vs. Binary transfer modes

In this demonstration we will be using ftp to transfer files from a Solaris 10 workstation to a Windows workstation using the dos command prompt ftp program to connect to the ftp port of the Solaris machine.

The two primary modes of transferring files via FTP are ASCII and binary. ASCII is an acronym for the American Standard Code for Information Interchange, an early standard of character encoding. ASCII mode in FTP is meant to transfer text files. Examples of ASCII files are .asp, .html, .php, .pl and .txt files. Binary mode in FTP is meant to transfer raw data files. Examples of binary files are .gif, .jpg, music and video files, as well as zipped (compressed) tar files. Be sure you understand the ftp ASCII vs binary differences so you know which file transfer mode to use.

 

ftp-transfer-ascii

Transferring a jpg file in ASCII mode, will get you something that looks like a screenshot of the game Pitfall! on the Atari 2600, circa 1982. It won’t look anything like the original file.

unix-cal-2012-black-ascii
Snapshot of a 2012 Unix Calendar jpeg transferred via FTP ASCII mode--psychedelic eh?
Pitfall_game_cartridge
Pitfall! Game Cartridge from Activision for the Atari 2600

So to transfer a non-text file with all the bits intact, use the binary mode by typing ‘binary’ at the ftp command prompt. In the dos version, you’ll see the “Type set to I” message rather than the “Type set to A” message for ASCII mode.

ftp-transfer-binary

Use binary transfer mode for your non-text files and they should arrive fully intact and legible:

unix-cal-2012-black-binary
Snapshot jpeg of a unix 2012 calendar transferred via FTP binary mode