newbie question: ftp.storbinary()

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Jan 24 00:06:59 EST 2007


"Scott Ballard" <scottballard at hotmail.com> escribió en el mensaje 
news:BAY119-F308650E60A44C911FD66C7C4AD0 at phx.gbl...

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

> 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???
The ftplib is perhaps too low level in this regard. There are a few 
variants: STOR, STOU, APPE. Try Google, or go right into the official 
specification, RFC959.
http://www.faqs.org/rfcs/rfc959.html (specially section 4.1, FTP Commands).
The example command above "STOR filename" will upload the file (the second 
argument to storbinary) overwriting without prompt any previous file with 
the same name (if it existed).

-- 
Gabriel Genellina 





More information about the Python-list mailing list