Here is a snippet of code I put together to take a file and upload it via FTP to a remote site.
import ftplib
# connect to the server
ftpsite = ftplib.FTP('ftpserver.address.com','FTPUSER','FTPPASSWD')
file = open('FileName.txt','rb') # file to send
ftpsite.storbinary('STOR FileName.txt', file) # send the file
file.close() # close file and FTP
ftpsite.quit()
There are a crapload of similar code snippets available here: Seb Sauvage’s Python Snyppets. Thanks for putting all of these online, Seb!
Oh brother, you always crack me up with your twisted takes on reality.