distinct filename arguments--local and remote also notice thatdespite its namethis module is very different from the getfile py script we studied at the end of the sockets material in the preceding the socket-based getfile implemented custom client and server-side logic to download server file to client machine over raw sockets the new getfile here is client-side tool only instead of raw socketsit uses the standard ftp protocol to request file from serverall socket-level details are hidden in the simpler ftplib module' implementation of the ftp client protocol furthermorethe server here is perpetually running program on the server machinewhich listens for and responds to ftp requests on socketon the dedicated ftp port (number the net functional effect is that this script requires an ftp server to be running on the machine where the desired file livesbut such server is much more likely to be available upload utility while we're at itlet' write script to upload single file by ftp to remote machine the upload interfaces in the ftp module are symmetric with the download interfaces given connected ftp objectitsstorbinary method can be used to upload bytes from an open local file object storlines method can be used to upload text in ascii mode from an open local file object unlike the download interfacesboth of these methods are passed file object as wholenot file object method (or other functionwe will meet the storlines method in later example the utility module in example - uses storbinary such that the file whose name is passed in is always uploaded verbatim--in binary modewithout unicode encodings or line-feed translations for the target machine' conventions if this script uploads text fileit will arrive exactly as stored on the machine it came fromwith client line-feed markers and existing unicode encoding example - pp \internet\ftp\putfile py #!/usr/local/bin/python ""store an arbitrary file by ftp in binary mode uses anonymous ftp unless you pass in user=(namepswdtuple of arguments ""import ftplib socket-based ftp tools def putfile(filesitediruser=()*verbose=true)""store file by ftp to site/directory anonymous or real loginbinary transfer client-side scripting