Electric Type

Multimedia

About Us

News

Help

FTP: For The People

Page 4 — ASCII versus Binary

Let's go back to the last four lines of the sample log that we examined on the previous page.

Command: LIST
Response: 150 Opening ASCII mode data connection for file list.
Response: 226 Transfer complete.
Status: Directory listing successful

See that server response that reads "Opening ASCII mode data connection for file list"? That's very important. File transfers over FTP take two different forms, ASCII and binary.

ASCII, otherwise known as American Standard Code for Information Interchange, is a set of 128 symbols that any computer in the world can display. You may be familiar with ASCII text, ASCII art, and ASCII files. Any file that is made up of text or text-based components, such as an HTML file, text file, or PostScript file, is an ASCII file. Binary files, on the other hand, are structured differently, and therefore require a different style of transfer. Images, applications, and algorithmically generated packages such as .zip and .tar files are all binary file types.

Just about every FTP client out there will automatically detect which transfer mode is required and treat your uploads and downloads accordingly. Most clients run in binary transfer mode by default, only using ASCII mode when it's absolutely needed. This is because both ASCII and binary files can be sent in binary mode with no problems, but sending a binary file in ASCII mode will corrupt the binary file's structure. ASCII mode makes for faster transfers, but if you accidentally upload a Microsoft Word file or JPG image in ASCII mode, your file will hit the server dead on arrival. If there's any question, transfer in binary mode.

Of course, we wouldn't have such a handy rule without one exception — CGI scripts. You must use ASCII mode when sending CGI scripts. They just won't work otherwise! Luckily, any files ending in .pl or .cgi are usually recognized as CGI scripts by your FTP client.

Quickly, here are some guidelines:

These file types are safe for ASCII transfer

  • Text files
  • HTML files
  • CGI scripts

These file types must be transferred in binary mode

  • Images
  • Applications
  • .zip, .sit or .tar packages
  • Proprietary file formats such as .doc, .xls, .fla, .swf
  • Anything that's not made entirely of text characters!

Now that you possess basic knowledge of the File Transfer Protocol and its many gifts, how about digging in and actually trying out some clients? Thought I'd never ask, huh?

next page»


Tutorials Home  

CSS Reference  

Regular Expressions  

Image Filtering  

Adding Site Search  

Image Maps  

Browser Detection  

Fundamentals of XSSI  

FTP Tutorial  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.