newbie question: ftp.storbinary()

S

Scott Ballard

Sorry for the lame question, I'm still trying to pick up Python and new to
the list here.

Question:
I'm trying to write a python script that will access an FTP site and upload
some files. I've gotten everything working except for the actual uploading
of the files.

I'm assuming that I should use storbinary( command, file[, blocksize]) to
transfer the files. the documentation says "command should be an appropriate
"STOR" command: "STOR filename"."

I can't seem to figure out an `appropriate "STOR" command' is???

Thank for reading my post.

Cheers,
Scott
 
A

Ayaz Ahmed Khan

"Scott Ballard" typed:
Sorry for the lame question, I'm still trying to pick up Python and new to
the list here.

Question:
I'm trying to write a python script that will access an FTP site and upload
some files. I've gotten everything working except for the actual uploading
of the files.

I'm assuming that I should use storbinary( command, file[, blocksize]) to
transfer the files. the documentation says "command should be an appropriate
"STOR" command: "STOR filename"."

I can't seem to figure out an `appropriate "STOR" command' is???

It frustrated the hell out of me too until I found this:

http://effbot.org/librarybook/ftplib.htm

The following works:

from ftplib import FTP
ftp = FTP()
ftp.set_debuglevel(2)
ftp.connect(_host, _port)
ftp.login(_user, _pass)
ftp.storbinary('STOR ' + _file, open(_file))
ftp.quit()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top