start page | rating of books | rating of authors | reviews | copyrights

Book HomeWeb Design in a NutshellSearch this book

4.4. Uploading Documents (FTP)

The most common transaction that a web designer will have with a web server is the uploading of HTML documents, graphics, and other media files. Files are transferred between computers over a network via a method called FTP (File Transfer Protocol).

If you are working in a telnet session on Unix, you can run the ftp program and transfer files with a hefty collection of command-line arguments (not covered in this book).

Fortunately, if you work on a Mac or PC, there are a number of FTP programs with graphical interfaces that spare you the experience of transferring files using the Unix command line. In fact, FTP functions are now built right into full-featured web authoring tools, such as GoLive, Dreamweaver, and FrontPage, among others. On the Mac, dedicated programs that allow "drag-and-drop" file transfer, such as Fetch and Interarchy (previously Anarchie), are quite popular. On the PC, there are numerous simple FTP programs, such as WS_FTP, AceFTP, and Transmit. These (and many others) are available for download at http://www.shareware.com (search for "ftp").

The Navigator and Internet Explorer browsers also function as FTP clients, offering the ability to both download and upload files with a drag-and-drop interface.

4.4.1. The FTP Process

Regardless of the tool you use, the basic principles and processes are the same. Before you begin, you must have an account with permission to upload files to the server. Check with the server administrator to be sure you have a login name and a password.

You don't necessarily need an account to upload and download files if the server is set up as an "anonymous" FTP site. However, due to obvious security implications, be sure that your personal directories are not configured to be accessible to all anonymous users.

  1. Launch the FTP program of your choice and open a connection with your server. You'll need to enter the exact name of the server, your account name, and password.

  2. Locate the appropriate directory into which you want to copy your files. You may also choose to create a new directory or delete existing files and directories on the remote server using the controls in your FTP program. (Note that some servers allow you to enter the complete pathname to the directory before logging in.)

  3. Specify the transfer mode. The most important decision to make during uploading is specifying whether the data should be transferred in binary or ASCII mode.

    ASCII files are comprised of alphanumeric characters. Some FTP programs refer to ASCII files as "Text" files. HTML documents should be transferred as ASCII or text.

    Binary files are made up of compiled data (ones and zeros), such as executable programs, graphic images, movies, etc. Some programs refer to the binary mode as "raw data" or "Image." All graphics (.gif, .jpeg) and multimedia files should be transferred as "binary" or "Raw Data." Table 4-1 includes a listing of the transfer mode for a number of popular file types.

    In Fetch (Mac), you may see a MacBinary option, which transfers the file with its resource fork (the bit of the file containing desktop icons and other Mac-specific data) intact. It should only be used when transferring from one Mac to another. This resource fork is appropriately stripped out of Mac-generated media files when transferred under the standard raw data mode.

    Some FTP programs also provide an Auto option, which enables you to transfer whole directories containing files of both types. The program examines each file and determines whether it should be transferred as text or binary information. This function is not 100% reliable on all programs, so use it with caution until you are positive you are getting good results.

  4. Upload your files to the server. Standard FTP uses the terminology "put" (uploading files from your computer to the server) and "get" (downloading files from the server to your computer), so these terms may be used in your FTP program as well. You can also upload multiple files at a time.

  5. Disconnect. When you have completed the transfer, be sure to disconnect from the server. You may want to test the files you've uploaded on a browser first to make sure everything transferred successfully.

4.4.2. Setting Permissions

When you upload files to a web server, you need to be sure that the files' permissions are set so that everyone is able to read your files. Permissions control who can read, write (edit), or execute (if it is a program) the file, and they need to be established for the owner of the file, the file's group, and for "everyone." When you create or upload a file, you are automatically the owner, which may mean that only you can set the permissions.

Some FTP programs enable you to set the default upload permissions via a dialog box. Figure 4-6 shows Fetch 3.0.4's dialog box for doing this. For most web purposes, you want to grant yourself full permissions but restrict all other users to read-only. You may want to confirm that your server administrator agrees with these settings.

Figure 4-6

Figure 4-6. Standard permissions settings (using Fetch 3.0.4)

The server needs to be specially configured to recognize these permissions commands, so check with your administrator to see if you can use this easy method. He or she will give you instructions if any special permissions settings are necessary.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.