Linux Web Hosting Manual & Guide
 

CHAPTER FOUR - Uploading and Downloading Files

4.1) Interfacing With Your WebSite

4.2) ASCII and BINARY Modes


4.1) Interfacing With your Website

In all the sections below, a distinction is made between transferring ASCII files and binary files. This is important -- you must transfer files in the appropriate mode.

Perl scripts and HTML files are ASCII files, along with many others. If you use a plain text editor to work with a file, it's an ASCII file. It's not terribly important to transfer HTML files in ASCII mode, but it is important for Perl scripts.

GIFs and JPEGs, as well as audio and video files, are binary files. They must be uploaded in binary mode, or will be corrupted. Files that look like garbage in a plain text editor and require a more advanced program to edit are not ASCII files, and must be transferred in binary mode.

 

4.1.1) FTP - Graphical Interface (wu_ftp, fetch, etc.)

Users with graphical interfaces can run a program such as WS_ftp, cuteFTP, or fetch to interface with HostForWeb. Just log into your domain name with the username and password we provide you. If you do not have your own domain name, we will provide you with the name of our host where your username resides.

See 1.2.1) Web Space in Chapter One for details.

4.1.2) FTP - Shell Interface

For users that are using a Unix-based system, at the shell prompt, type ftp your-domain.com. Then enter your username and password when prompted.

To transfer ASCII files (text)

  1. Type ascii to make sure you are in ascii mode.
  2. Move to the proper directory using the cd command
  3. Type put filename to transfer a file to your website.
  4. Type get filename to get a file from your website.

To transfer Binary files (graphics)

  1. Type binary to make sure you are in binary mode.
  2. Move to the proper directory using the cd command
  3. Type put filename to transfer a file to your website.
  4. Type get filename to get a file from your website.

4.2) ASCII AND BINARY MODES

Go up and read 4.1. It's covered there.

So why this section? If this seems obvious, sorry, but probably the single biggest type of problem we have to correct or tell users to do over is problems caused by having the wrong mode active. We needed this in big letters so you'd find it.

 In case you're wondering what the fuss is about -- aren't text files standardized? -- here's the explanation. While ASCII is a standard for encoding text, it does not specify how to end lines. There are two obvious candidates in the ASCII character set: CR and LF. *nix machines, such as the JJsWebDev WWW machines, use LF to terminate lines. Macintoshes use CR. DOS, Windows, and NT machines use CR LF (both, in that order). When transferring files between machines of different types, you need to account for this, hence ASCII mode. To avoid damaging binary files (where the bytes don't have the ASCII semantics) there is binary mode.