python script to upload file to server code example
Example: python script to upload file to server
from ftplib import FTP
ftp = FTP('123.server.ip')
ftp.login(user='username', passwd = 'password')
ftp.cwd('/whyfix/')
def grabFile():
filename = 'example.txt'
localfile = open(filename, 'wb')
ftp.retrbinary('RETR ' + filename, localfile.write, 1024)
ftp.quit()
localfile.close()
def placeFile():
filename = 'exampleFile.txt'
ftp.storbinary('STOR '+filename, open(filename, 'rb'))
ftp.quit()
placeFile()