Sending a File to an InterNet Host

Firstly, establish a connection with the remote machine, as illustrated in the previous section. Sending a file is identical to retrieving a file, except that the put command is used in place of get, eg :

ftp> put rfc822.doc 200 PORT command okay. 150 Opening data connection for rfc822.doc (0.0.0.0,1315) 226 Transfer complete 98932 bytes sent in 4.02 seconds (24 Kbyte/s) ftp>

Here, the local file rfc822.doc is sent to the remote host, which stores it under the same name.

ftp> put (local-file) paper.doc (remote-file) paper.txt 200 PORT command okay. 150 Opening data connection for kermit_docs (0.0.0.0,1315). 226 Transfer complete. 97902 bytes sent in 4.51 seconds (21 Kbytes/s) ftp>

In this case, the local file paper.doc is sent to the remote host, and stored as paper.txt.

Again, once you have finished transferring files, close down the session as detailed previously.