Transferring Files

The World Wide Web is primarily a one-way medium—your web client retrieves pages distributed by a web server. This is partly due to the design of the HTTP protocol, which allows servers to send out information very efficiently. However, when designing an publishing web pages, you'll need to send information to the server, and this is often done using an FTP client. FTP is more of a two-way protocol, and allows you to put files on the server as well as get them off.

Originally, FTP clients were command-based, and difficult to use. Now, there are many graphical clients that allow you to FTP by dragging and dropping or manipulating icons. The free FTP client that's installed on the public PCs, FileZilla, is somewhere between the two--it provides a graphical way to issue FTP commands. There's a local guide [link to be added] to using FileZilla that you should read before you try to publish your web pages.

One thing to watch with FTP is whether your files are transferred using ASCII or binary mode. The ASCII mode should be used for any plain text files (including .htm, .html and .txt files), and the binary mode for almost everything else. The reason for this is historical; UNIX systems (such as most web servers) mark the end of each line of a text file differently to MS-Windows and MS-DOS computers. If a text file written in Windows is transferred directly to a UNIX computer (ie using binary mode), the UNIX system can't tell where the ends of lines are, and odd things happen. When ASCII mode is selected, the FTP program translates the end-of-line markers from one system to the other, creating files that work properly. If you get lots of ^M characters appearing, or everything appears on a single, very long line, you'll know that the file has not been translated in this way.

Figure 3.5. A command-line FTP client

Source: Captured locally.


Security and FTP.  There is one major drawback to FTP. When you make the initial connection, your password for the server is sent across the network in plain, readable text (you can even download programs —packet-sniffers— which will read these passwords as they go whizzing past your PC). On a modern, properly designed intranet (i.e. the network within an organisation or company) this isn't a problem, but if you're accessing the FTP server across the Internet, any number of people could read that password.

To solve this problem, there're secure versions of the FTP protocol, called SFTP and SCP. These are entirely encrypted, so not only is your password safe, but all the data that you transfer is protected too. You can download a Windows application called WinSCP which speaks both of these protocols, though beware that not all servers can talk the SFTP/SCP protocols yet.