PATH: Instructional Server> Internet>

An Example of Internet File Transfer with FTP


File Transfer Protocol (FTP) has been used since the early 1970's as the standard method for transferring files of any type from one computer to another on the Internet. Although sophisticated GUI-based FTP clients such as [FileZilla] (with versions for Linux, Mac, Windows, or [Portable/USB]) have been developed that allow fast and easy drag-and-drop file transfer between Internet computers, it benefits all users to learn how to use a basic character-based FTP client. All modern operating systems provide (at least) a character-based FTP client. This program is often critical to the acquisition and installation of further important software, such as drivers and upgrades. Those who use more than one operating system are pleased to discover that character-based FTP clients are almost identical regardless of platform. For general information about FTP and a detailed list of the optional features offered by character-based FTP clients, review FTP - File Transfer Protocol page on this site.

The bulk of this web page is devoted to a demonstration of using a character-based FTP client to upload a file to the IRSC Student (Linux) Server used in some courses taught by the Computer Science Department. Readers who are interested in learning alternative procedures using the File Explorer utility in Windows® to perform FTP transfers should read one of the following web pages:

   [Access FTP Sites Natively in Windows 7]
   [Setting up Windows Vista for FTP]
   [Setting up FTP via File Explorer in Windows XP]

This example demonstrates use of the character-based FTP client in Windows (any version), but it should work almost the same on any operating system that offers a character-based command prompt. Be aware however that many servers are controlled by operating systems that are case-sensitive, which is true of the IRSC Student (Linux) Server. So users must give careful attention to their use of case when typing commands. The information required to connect to an FTP Server is: the server's fully-qualified domain name or IP number, user's account name and password, and any special options that must be used to accomplish the connection. The information required to perform an FTP transfer (upload or download) is: the filename and path to the file to be read and and filename and path to the file to be written. It is also important to know if the file being transferred is a text file or not, as these are transferred differently from non-text files such as: pictures, music, and programs. The method of transfer is called the transfer "mode" (meaning "method of operation"). Text files are transferred using a mode named "ASCII mode". Non-text files are transferred using a mode named "Binary (or Image) mode". This example is based on the following specifications for a fictitious student named Andy Baker with student number of A12-34-5678 uploading a web page that he has saved on a USB memory stick to his public web folder on the student server.

Specific Steps:

  1. From the Windows Desktop, Andy clicked on Start, then selected Run....
  2. A "Run" dialog box appearred in which he could type character-based commands. He typed FTP in the "Open:" textbox and clicked on the OK button.
  3. A black and white command window appeared in which the character-based FTP client was launched. Such clients display the prompt ftp> whenever they are ready for a new command.
  4. Andy opened a connection to the FTP server by typing open student.irsc.edu and pressing the Enter key. The server responded: Connected to student.irsc.edu
  5. When prompted for "User ... :", Andy entered his username A12345678 (with first letter capital).
  6. When prompted for "Password:", he entered ab45678 (notice: lowercase letters). He did not see the keystrokes echoed on the screen, so he typed carefully. He then saw the following messages:
    230 Login successful.
    ftp> 
  7. Next Andy examined his connection status with the FTP server to determine the current setting fo the transfer mode using the command: stat
    He saw:
    Connected to student.irsc.edu.
    Type: ascii; Verbose: On ; Bell: Off ; Prompting: On ; Globbing: On
    Debugging: Off ; Hash mark printing: Off .
    ftp>
  8. If he has not seen Type: ascii; in the status report (on first line), he would have changed the transfer mode to ASCII using the command: asc
    He would receive a reply like "Switching to ASCII mode".
  9. Then, Andy chose to switch on the Hash mark printing feature of FTP, which displays the '#' symbol once for every two kilobytes of data transferred, using the command: hash on
    This provides visual feedback like bar chart (made of #'s) showing the progress of any file transfer.
  10. Then Andy had his FTP client query his local operating system (Windows) regarding the current working directory with the command lcd which is short for "local current (or change) directory". Windows reported his current working folder as
    Local directory now C:\Users\Andy.
    ftp>
  11. Andy next commanded his local operating system to change the current working directory to be the folder on his memory stick tha contained his web page file using the command lcd F:\projects. Windows reported his current working folder as
  12. He then had his FTP client query his local operating system (Windows) regarding the contents of the current working directory with the command !dir. (The exclamation point can be used to pass character-based commands that are known by the operating system to its command interpreter for execution.) Windows listed the contents of his current working folder, in which he saw his file named practice.html listed.
  13. Next, Andy used the dir (without !) command to display the directory contents on the server. He saw any files or sub-directories (folders) stored there, including a folder named cd public_html.
  14. He changed to the public_html directory using the command: cd public_html
  15. He then used the dir command to display the sub-directory's contents on the server. He saw any files or sub-directories (folders) present in that folder.
  16. Andy was now ready to upload his file practice.html from the current working directory (F:\projects) on his memory stick to the current working directory (public_html) on the server using the command: put practice.html
    He paid close attention to case. As the transfer took place, he saw the message below which included a short bar chart constructed from hash marks.
    200 PORT command successful. Consider using PASV.
    150 Ok to send data.
    ##
    226 Transfer complete.
    ftp: 4405 bytes sent in 0.01 Seconds 2205000.00 Kbytes/sec.
    ftp>
  17. Andy's transfer was successful. But he was still connected to the server. So he closed his connection with the FTP server using the command: close
  18. The server sent a parting message. So with his FTP activities complete, Andy terminated the FTP client program with the command: quit

All that was left now was to test whether his web page file could be retreived and rendered by a web browswer. So Andy opened his browser and entered the following web address (corresponding to the location of his public web folder on the student server:

    http://student.irsc.edu/~A12345678/practice.html

Notice the presence of the tilde (~) character in the URL above, indicating a path to Andy's public web folder (public_html) on the student server. This is a standard notation used on Linux systems that host web pages beneath the home folders of individual account holders. The path http://student.irsc.edu/~A12345678/ maps to the user Andy's public_html folder. All web content beneath that point can be reached using a URL that starts with the path http://student.irsc.edu/~A12345678/.

PATH: Instructional Server> Internet Fundamentals>