Sunteți pe pagina 1din 12

Getting to know FTP

FTP (File Transfer Protocol) has been around for a quite a few years now.
It has been used for file transfers since the 1980s. A common operating
system was UNIX (forerunner of Linux) and most programs were run
from the command line prompt, similar to that used in DOS, the
forerunner of Windows.
FTP is available in Windows as a ?command line
prompt? program. Once you have an Internet connection
established, either via a dial-up modem or else through your local area
network, the FTP program that comes with Windows can be used to
transfer files. It is great to know about this FTP program as it is
automatically installed with Windows, so if you (as a web developer) are
visiting a client, their Windows machine will also have FTP available. As
well as being the standard means for website up-load s, a vast store of
software applications, games, images, and other types of files are
available on FTP sites all over the world.
File Transfer Protocol uses the clientserver model. One computer (the
FTP host) runs a server program serving information to other computers.
The other computers run client programs requesting information and
receiving replies from the server.

Running FTP in Windows

In Windows, you
can start FTP by
choosing:
Start > Run
Then type ftp and
press <Enter>

The FTP screen

When ftp starts, you will have a black hole window with the ftp>
prompt showing. If you type help you will get a list of the available
commands in ftp. That has been done in the screen shot above.

Help with commands.

To get help with individual commands, you can type help commandname, for example help ls, help bye, help hash, help mdelete, and so on,
as shown here:

Connecting to an FTP server

From the FTP screen you can connect directly to the file structure of an FTP server, and
work with the operating system of the remote computer.
You will need an ftp user namee and password. Either your web hosting service or your
RTO can tell you these details. Then you can run the ftp command to transfer files.
Make sure that you have an Internet connection first if you intend to use it for some real
file transfers. Then start FTP running.
Most FTP sites support anonymous logins where you dont have to have an account on
the FTP site in order to access the site and download files.
The user ID is the word anonymous and the password is your email address.
Often files obtained from anonymous ftp servers will be in zipped format (filename.zip).
Zip is a compressed format, allowing the file to download more quickly (and take up less
room on the server). A Zip file must be unzipped (uncompressed) once it is downloaded.

Using the FTP client to connect


Start the FTP program running and alongside the ftp> prompt, type the command:
open ftp.ihug.com.au
IHUG is an Australian Internet Service Provider. Like most service providers, they keep
an FTP server with free software and shareware stored on it.
If you don't have an account with download, you can login as an anonymous user by
typing the user name: anonymous and a password that is your email address.

If you had your own account on IHUG, you could type your own user name and password
to login. Then you would see only your own files.

Where am I?
Once you are logged in, you can browse your way around the directories (or folders) of
the FTP server.
The command pwd (meaning "print working directory") will tell you the name of the
directory you are in. To see the files in the directory or folder, use the command ls
(standing for "list").

In this case, the working directory is "/" (which is pronounced "root"). The root directory
also contains 5 other directories or files: debian, pub, mirror, debian-non-US and
welcome.msg.
Note that the FTP client program adds some commands of its own: 200 PORT command
successful, 150 Opening ASCII mode data connection for file list.

Doing other things


When using this command line type of ftp client,you can:

change directory (using the cd command)

list files (using the ls command)

make directories (mkdir, if you have permission)

delete files on either local or remote machine (del or delete, if you have
permission).

Make sure you take note of the differences when you examine the commands offered by
such an ftp client.
Try some of these commands out if you have FTP access to a files that you own.
To close the connection, use the bye command.

One thing to watch is that FTP closes a connection if nothing happens for 5 minutes (300
seconds).

Is FTP really that hard?

So far, FTP has been a lot of work! It's difficult for most people to get used to using a
command line program like FTP for Windows. Most people are used to managing their
files using programs like Windows Explorer. So many software developers have created
graphical file manager interfaces that do all of the FTP commands behind the scenes so
the user doesn't have to worry about them.
Some of these FTP programs are free, while some are share-ware. Some examples are:

CuteFTP

http://www.globalscape.com/products/cuteftp/index.asp

WS_FTP (LE PRO)

http://www.ipswitch.com/Products/file-transfer.html

FTP Voyager

http://www.ftpvoyager.com/

SmartFTP

http://www.smartftp.com/

FTP Explorer

http://www.ftpx.com/

CoffeeCup Free FTP

http://www.coffeecup.com/software/

FTP Commander

http://www.Internet-soft.com/ftpcomm.htm

In this article, we will use WS_FTP, but pretty much the same techniques apply to all FTP
clients.

Using a graphical FTP client


These screen shots were made using WS_FTP LE (freeware). Other clients will look
similar but not exactly the same.
When you first start WS_FTP it displays a screen for you to select the FTP site you want
to connect to:

To connect to your own website, you must supply your ISP, your user name and your
password.
Once you have logged in, the client displays two panes: one contains your Local site files
(those on your hard disk) and the Remote site files (those on the server).

To copy files from one site to the other, you can simply drag and drop files from one pane
to the other.
Some FTP clients create a Pending list. This shows the files in the queue to be transferred.
Navigation through the file structures is simply point-and-click, just like in any other
Windows application. A few FTP clients have a synchronise feature where both sites
change folders at the same time.

Up loading your website

Firstly, have a current, offline version of the complete web site (on your hard disk drive).
Start the FTP client and use it to navigate to the folder where your website is stored.
Enter the details of your remote website and login with the FTP client.
If you are up loading the site for the first time, you can just drag all of the files from the
local folder to the remote folder. The FTP client will then transfer all the files and when
complete, it will usually update the folder listing at the remote end.

Maintaining the website


First, it's not a good idea to work directly with your website. What happens if you lose
your connection just as you're up loading the latest version of your home page? Nobody
will be able to access your site!
Most large commercial organisations maintain two sites: the real site that the public gets
to see and a staging site that they use for testing and trialling. You won't be able to do that,
but the copy of your site on your hard disk can be your staging site.
When you are maintaining a site, you usually only make fairly minor changes to a few
files at a time.

The only files and folders that "go live" for the CLC site are those highlighted above. The
Library folder was created by my web authoring software. The "Incoming..." folders are
for storing updates received by email.

I need to update events.html and region.html. Firstly I made a folder called


Incoming_4.10.01 for the new files. Inside that folder I prefixed each of the filenames
with a "1" to distinguish them from the files that are part of the current site. So the
filename events.html became 1events.html.
It is best to open the old and new versions of the files in your web editor and copy-andpaste the new content where necessary. DONT just replace the old file with the new one
as you'll probably end up with broken links and other problems.
Notice that 1region.html has a broken link (button cannot be found), as shown in the
screen immediately below. Dont try to fix this. The person that sent the update is not
working with the latest version of the site, but this is OK.

The diagram below shows my hard disc drive version which is an exact copy of the live
version) opened in a web editor. The link is OK.
Remember, the version on your hard disk should always exactly match the live version of
the site. The disk version should be updated, tested and then these updates up loaded to
the web. After this upload, both your disk version and your live version are in synch
again.
Now with both region.html and 1region.html open, I simply copy the relevant data from
1region.html and paste it into the same location in region.html.
If I now sort the list by Modified Date my new file versions float to the top of the list:

Up loading the changed files


Now you're ready to upload the new files on to the live server.
First, check that your FTP client is set up correctly. You will need a user name and a
password to be able to access the site.

Log on to the Internet. Start your ftp program. Choose your own site and find the
correct folder on your hard disk:

On the remote site (the Internet version) you will usually see something like this in your
ftp program:p>

Change to the appropriate folder. In this case it is /public_html/frames:

Finally, highlight the files to upload on the hard disk and click the upload button:
Now use your browser to check that everything on the updated live site still works:

So there you have it! FTP without tears!

S-ar putea să vă placă și