CHAPTER NINE - Uploading and Downloading Files


9.1) FTP & Telnet

9.2) ASCII & Binary Modes


9.1)FTP & Telnet

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 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.

 

9.1.1) FTP - Graphical Interface (ws_ftp, fetch, etc.)

The process by which files are transferred to the web server is called "FTP" (File Transport Protocol). You have unlimited access via FTP 24-hours a day. As such, you can create and maintain your web pages on your own computer and upload files to your web site at your leisure.

Internet providers such as AOL, CompuServe, and Prodigy may have a built-in FTP interface. If you have a PPP internet account and need an FTP program, you can download software for for either the PC or Mac. We suggest that you contact your local internet provider to inquire about compatibility. Microsoft FrontPage users whom have had extensions installed within their web site should use FrontPage to transfer files only.

Configuring Your FTP Software
The following information is contained within your account activation notice and is needed to connect to your web site via FTP: The hostname tells your FTP software to connect to the web server upon which your web site resides. (This will be your domain name.) In general, the process of configuring the various FTP software is the same. We recommend WS_FTP for PC computer users and will be using it in the upcoming examples.

Each time you run WS_FTP the Session Profile window will be displayed. A profile contains the information needed to connect to your web site. Creating a profile now will eliminate the need for you to configure the software each time you wish to connect to the web server via FTP. To create a new profile, click the "New" button and enter a generic profile name at the top of the Session Profile window. Next, enter the userid, password and hostname for your web site.
Be sure to select "Auto detect" for the Host Type. (see Fig.1) It is best to select "Save Password" and "Auto Save Config" to maintain these settings for future use. All other fields can be left blank. You are now ready to connect to the web server. Click "Ok" to continue.

How to Transfer Files
When you connect to the web server, you will connect directly to the root ("home") directory of your account. WS_FTP will display a split screen where files on the left-hand side are within your own computer. (see Fig.2) You will see several folders on the right-hand side such as bin, cgi-local, dev, etc, lib, and stats which are landmarks suggesting a successful connection to your web site.
You can transfer files directly to the root level and/or create subdirectories. The only system directory that you may need to use is cgi-local; this directory is reserved for custom scripts. To make your home page load automatically, name the HTML document "index.htm" or "index.html" in lowercase and upload it to the root directory of your account. To upload a file or files, simply highlight the file(s) on the left and click the right-arrow button ("-->") in the center of the screen. Be sure to upload HTML documents and scripts in ASCII mode and images in BINARY mode. To transfer a file to a subdirectory, double-click the appropriate subdirectory to open it before transferring the desired file(s).

As soon as a file is uploaded to the web server, it is available for all to see. If, after uploading a file, you are still unable to see the updated file via Netscape, you need to clear both disk and browser cache. This function can be found by selecting Options > Network Preferences in Netscape. Remember that you must first be connected to the internet through your local internet service provider in order to connect to the web server.

Notes to Mac Users
  • Select "raw data" transfer mode when using Fetch to transfer both HTML and images.
  • PageMill may add either a .bin or .txt extension to your files which must be removed in order for such files to load properly.
  • Viewing Web Pages in Netscape
    Webmasters often modify an HTML document and reupload it to the server. After returning to their web browser they click RELOAD only to find the original document unchanged. This is a common occurrence for Netscape users and is easily remedied by holding down the shift key while clicking on reload.

    9.1.2) FTP - Shell Interface

    For Unix users, at the shell prompt, type ftp your-domain.com. Then enter your userid and password when prompted.

    ASCII files (text)

    Type ascii to make sure you are in ascii mode.

    Type put filename to put a file.

    Type get filename to get a file.

    Binary files (graphics)

    Type binary to make sure you are in binary mode.

    Type put filename to put a file.

    Type get filename to get a file.

    Multiple files: type prompt and be sure the message you get says something like 'prompting disabled'. (Not necessary, but certainly nice when doing a lot of files.) Then, type mget *gif to get all the files ending in gif or mget sausage* to get all the files starting with sausage. There is also an mput command for doing the same thing in the other direction.

    9.1.3) Telnet - Graphical Interface

    Simply run the program on your machine that contains telnet in its name. Then log onto your-domain.com (or .net or .org) with your userid and password.

    Once logged on, you may use the following commands (assuming your telnet program knows or can be taught about ZMODEM, which often isn't the case):

    ASCII files (text)

    Type rz to put a file.

    Type sz -a filename to get a file.

    Binary files (graphics)

    Type rz filename to put a file.

    Type sz -b filename to get a file.

    9.1.4) Telnet - Shell Interface

    At the shell prompt, type telnet -8 your-domain.com. Then enter your userid and password when prompted.

    Once logged on, you may use the same commands listed in the last section.

    9.2) ASCII AND BINARY MODES

    Go up and read 9.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.

     Macintosh users: in Fetch, the binary mode referred to throughout the manual is 'raw'. The other option uploads too much data, corrupting the file. ASCII mode is 'text'.

    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. (Carriage Return and Line Feed.) *nix machines, such as the Web 66 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.


    Back to the Table of Contents