the magical world of FTP

     

    getting started

    FTP (meaning File Transfer Protocol) is a program used for moving files between computers on the internet, usually from your machine to a remote web server and vice versa. Normally, you need to know the following things before you can FTP:

    1. Your user id and password - specifically, the user id and password for your account on the remote machine. It is possible to connect to an anonymous ftp server - these are usually software repositories from which you can download software. Typically, you use either no user name or password, or "anonymous" and your email as a password.

    2. The name of the machine you're connecting to. This can either be a URL (such as ftp://ftp.server.com) or an IP address (such as 111.222.333.444). If you're creating a web site, and you have an internet account, you'll have to ask your ISP what the correct machine address is for FTP.

    3. The remote location for your files. In some cases, you will automatically be routed to the right folder; again, check with your ISP for more information. However, you will frequently find (for web sites) that you're looking for a folder such as "html", "public-html", or "http-docs."

    Naturally, you'll need an FTP program as well. Fetch is a popular FTP client on the Macintosh, CuteFTP is a popular client for windows, there are zillions of others.

    Once you've connected to a remote server (the hard part), moving files around is easy. The left window of the FTP program is your local drive, the right window is the remote file system. Usually there's an up arrow at the top of both sides, which is how you move up a directory; double-clicking on a folder is how you move into a directory. Once you've found the folder with your local files, and you've found the remote folder you want your files in (or are getting files from), drag the files (or folders of files) from left to right to upload them, right to left to download them. Most FTP clients disconnect after a few minutes - you might need to "Reconnect" (typically under the File menu) before you upload/download a file (put it back on the server).

     

    rules of the road

    Without getting too deeply into site maintenance (a separate lecture entirely), there are some basic things you should be aware of before you start moving files around on the web. For instance, you should always be aware that any file downloaded from a remote computer could have a virus. You should always have current virus protection software scanning incoming files (and emails too, for that matter).

    Further I generally think it's wise to regard your local files as working copies, and the web site as the final product, even if you're about to update the web site. Unless you're creating a new site, the site itself is already working - one thing you really don't want to do is break it. Here are some basic rules to follow:

    • As soon as you've downloaded a file onto your computer, MAKE A COPY, and put it someplace safe. This copy is as good as the original. If you modify a local file, and upload it, and the site breaks, you can always put back the copy of the original you so wisely made before you started.

    • After you upload a modified file, you will typically need to "Reload" the web page in your browser (usually control-R or command-R) in order to see the changes you've made. You may well discover that somehow, you've HORRIBLY MESSED THINGS UP. Referring to rule number one, upload the copy of the original you made back to the web server, and you will have restored the web page to its original state, thank god.

    • Always check your modified pages by viewing them with your browser on your local machine to make sure they look generally correct. Note that the way that pages refer to each other, and to images involves path naming conventions, and that the pages may only look right on the web server itself.

    • Unlike your OS, FTP will happily overwrite files when you upload them. That is, when you put a file on a remote server, even if there is already a file by that name, you will not be prompted with an "is this ok??" message. It's quite easy to accidentally delete remote files this way, so be certain you're uploading the right version of the right file to the right place before you start.

    • When in doubt, ask first.

    There's tons of stuff on the web about this, and good books (look for anything published by O'Reilly) at your local B&N or Amazon - it's not that tough once you've plowed through it once.

     

    files and formats

    One more thing, and this is a biggy. Moving files from computer to computer actually involves moving files from one operating system to another. Frequently, the remote system will be different from yours (most often Unix, though it could be anything). Different OS's treat files, file names, and file formats quite differently. A few things to be aware of:

    • file names - on a macintosh, file names can be anything you like - the OS doesn't care. However, punctuation, capitalization, spaces, upper and lower case all make a big difference. As a general rule, always name your files using only letters and numbers, and be certain that any hyperlinks you have use the same case as the file names. It's not uncommon for a web page to work locally but not remotely for this reason.

    • file extensions - many OS's and many software programs expect a file extension in order to identify the file type - ".htm" means HTML, ".psd" means Photoshop, etc. etc. Most file extensions are three letters, it's best to stick with three unless you have good reason to do otherwise. Note that Windows appends extensions to files automatically, Macintosh in particular does not use file extensions, but web server programs typically expect them - it's good to get in the habit of naming your files appropriately. Another way that this can be referred to is "Mime type"; i.e., "what type of file should I, the web server represent this as?" Here are some common examples:

      • .cfm - a Cold Fusion web page

      • .exe - an executable program

      • .gif - a GIF encoded image

      • .htm - HTML

      • .jpg, .jpe - a JPEG encoded image

      • .pdf - an Adobe Acrobat file

      • .txt - a text file

        etc etc - the list goes on and on.

    • file formats - there are many files which are intended to be interpreted by a specific program, but which are in fact just text files. HTML is an excellent example - there are no special characters in an HTML file. In fact, in order to have special characters on a web page, you have to use special text encodings - for instance, to produce the name Gödel, you have to actually type: G & o u m l ; d e l (web design software usually offers you a palette of "special characters").

      There is, believe it or not, more than one way to hit "return" (or "enter"). Line-breaks, line-feeds, carriage returns, newline characters are not all the same, and sometimes transferring a file from one OS to another can "break" the file. Mostly, what you need to do (particularly on a Macintosh) is make certain you tell the FTP client to upload a Unix-compatible file (set in the upload preferences). Also, FTP transfers text files and binary files (such as software programs) differently, so it's important to set the type of upload or download you're trying to effect (again, in the upload/download preferences). It's "safest" to move all files as though they're binary - this should leave any file unaffected by the transit.

 

 

 

all content © copyright 2003 neil verplank, unless otherwise stated