Copying Files Across the Network with FTP
FTP (short for File Transfer Protocol) is a standard method of sending
files between
computers through a network. The primary difference between FTP and
HTTP is that
using FTP requires that you identify yourself with a user name (also
known as a login)
and a password. (Imagine if HTTP were like this. You would have to type
in a user
name and password every time you clicked a link!) In this part of the
lab, you will use
FTP to put your first file on the web, i.e., use FTP to make a file
publicly available via
HTTP.
An FTP server is a lot like a bank for files, i.e., a computer on the
network with lots of
hard disk space that offers individual users access to private storage.
Just like with a hard
disk on your own computer, you can copy, delete and rename files on an
FTP server, as
well as maintain folders to keep your files organized. You use FTP
client software to
connect with an FTP server, just as you use a web browser (web client
software) to
connect with an HTTP server (web server).
We learned that web pages are stored and delivered from web servers,
but how do web
pages get to a web server in the first place? Sometimes, web authors
create and edit them
on the web server directly, but this is not the usual case. Typically,
a web author edits a
page on their own computer, makes sure the page looks right, then
transfers a copy to the
web server. As soon as a file is transferred to a web server, it
generally becomes publicly
available, so working on their own computer helps ensure that there are
no mistakes in
the pages that actually go on the web, or “go live,” as some people
say, borrowing the
expression from broadcast media. In this part of the lab, you will
follow the same
process to put your first file on the web. You will start by posting a
plain text file in this
lab.
1. Use a text editor such as Notepad (Windows) or TextEdit (Mac)
to
create a new text
file named bio.txt
containing a single line that contains your name, today's date,
and a short greeting
such as "Welcome visitors." Save the file on the Desktop.
In the lab, Notepad is located in
Start Menu > All Programs > Accessories > Notepad
2. Using Windows, start SSH Secure File Transfer, an FTP client
program.
In the lab, the program can be found in
Start Menu > All Programs > SSH Secure Shell > Secure File
Transfer Client
(On Mac, use CyberDuck or other FTP client).
3. When the application appears, click "Quick Connect".
(Ignore an error message that appears).
Complete two fields for host name and user name.
The server’s
hostname: polylog1.calpoly.edu
Your user name: Cal Poly portal username
Click Connect.
(You might see a dialog titled, “Host Identification.” Double-check
that you have
the hostname right, then click Yes.)
When prompted for your password enter your portal password.
"Add to profile" dialog will flash for a few seconds then disappear.
Note: Your user name and password
are the
same as your
myCalpoly login.
4. The SSH FTP window looks a
lot like Windows File Explorer, with the left pane showing a folder
hierarchy
and right pane
showing files in the currently selected folder. Unlike Explorer,
however, the items in the
right panel are folders and files on the ftp server, polylog1, not on
the computer you
are sitting at.
local vs. remote – “Local” is used to
describe anything that is on the
computer you are
currently working on, physically. In contrast, “remote” describes a
resource that is
physically elsewhere but accessible to you via the network. That
explains why the dialog
shown above has the title “Connect to Remote Host.”
5. Your space on the ftp server
is set up with a folder with a special name whose contents
can be made accessible via
the web. This “web folder” is named public_html.
Select
the web
folder by double-clicking it in the
right pane to open it.
6. The process of sending a
copy of a file to a remote server is called uploading. To start
an
upload,
simply drag the bio.txt
file from the left pane and drop it in the right pane.
When the transfer is complete, you should see the file in the right
pane of the
SSH ftp window.
7. Now you should verify that the file is available on the web.
The URL for the file you just
uploaded is shown below, except put your Cal Poly username in place of yourusername.
http://www.calpoly.edu/~yourusername/bio.txt
Leave SSH ftp open for now, and open a web browser window with the URL
of
your newly uploaded file. You should see the file’s contents in your
browser window.
TROUBLESHOOTING:
If you are not able to access your text file using your web
browser, do not panic. Start by identifying what kind of problem the
server is
having. Check the title bar of your browser window for an error code
number and
a brief description of the error. Here are some tips for dealing with
the more
common errors:
“404 Not Found” – Your URL specifies a file that does not exist on the
server. Double-check all parts of the URL, especially the hostname,
your user
name, and the filename itself.
“Permission Denied” – The server has located the file, so your URL is
correct,
but the file’s properties on the server are set such that it is not
publicly
readable. See the next step for how to fix this.
“Cannot Find Server or DNS Error” – The hostname part of the URL is
probably mistyped. Recall that DNS is the system by which hostnames are
converted into IP addresses. If you request a host whose name is not
registered with DNS, you will get this error.