Discussion:
newbie question: ftp.storbinary()
Facundo Batista
2007-01-24 12:53:16 UTC
Permalink
Sorry for the lame question, I'm still trying to pick up Python and new to
the list here.
Welcome!
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"."
fp = open("/tmp/file_to_transfer.txt") # open the file
self.ftp.storbinary("STOR file_to_transfer.txt", fp) # note that the name has not the path
fp.close() # close the file, :)
Regards,
--
. Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
Scott Ballard
2007-01-23 21:08:57 UTC
Permalink
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
Gabriel Genellina
2007-01-24 05:06:59 UTC
Permalink
"Scott Ballard" <scottballard at hotmail.com> escribi? en el mensaje
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...
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
Loading...