Welcome, guest | Sign In | My Account | Store | Cart

Sending files to a web server via FTP.

Python, 6 lines
1
2
3
4
5
6
import ftplib                                          
session = ftplib.FTP('SERVER NAME','USERNAME','PASSWORD') 
myfile = open('YOUR FILE','rb')                        
session.storbinary('STOR YOUR FILE', myfile)           
myfile.close()                                         
session.quit()                                         

How to use: Replace SERVER NAME with the server name you would like to connect to. Replace USERNAME with your FTP login for that server. Replace PASSWORD with the password that corresponds to your FTP account. Replace YOUR FILE (There are 2 of them) with the file you would like to send.

As far as it goes, I am pretty sure this works. If it doesn't please tell me and I'll fix it.

Created by Jonny Reeves on Sat, 4 Oct 2008 (MIT)
Python recipes (4591)
Jonny Reeves's recipes (2)

Required Modules

Other Information and Tasks