from tkinter import mainloop
import putfile, getfilegui
class FtpPutfileForm(getfilegui.FtpForm):
title = 'FtpPutfileGui'
mode = 'Upload'
def do_transfer(self, filename, servername, remotedir, userinfo):
putfile.putfile(filename, servername, remotedir, userinfo, verbose=False)
if name == 'main':
FtpPutfileForm()
mainloop()
Running this script looks much like running the download GUI, because it’s almost
entirely the same code at work. Let’s upload some files from the client machine to the
server; Figure 13-4 shows the state of the GUI while starting one.
Figure 13-4. FTP putfile input form
And here is the console window output we get when uploading two files in serial fash-
ion; here again, uploads run in parallel threads, so if we start a new upload before one
in progress is finished, they overlap in time:
C:\...\PP4E\Internet\Ftp\test> ..\putfilegui.py
Server Name => ftp.rmi.net
User Name? => lutz
Local Dir =>.
File Name => sousa.au
Password? => xxxxxxxx
Remote Dir =>.
Upload of "sousa.au" successful
Server Name => ftp.rmi.net
User Name? => lutz
Local Dir =>.
File Name => about-pp.html
872 | Chapter 13: Client-Side Scripting