Hello, I have posted before about trying to find the status of an FTP
uplaod but couldn't get anything to work. After some more searching I
found
but it does not seem to work because it just uploads the file and does
not print a . onto the screen. HEre is the code I have when I'm using
the code from that link.
import ftplib
import os
class dot_FTP(ftplib. FTP):
def storbinary(self , cmd, fp, blocksize=8192) :
self.voidcmd('T YPE I')
conn = self.transfercm d(cmd)
while 1:
buf = fp.read(blocksi ze)
if not buf: break
conn.send(buf)
sys.stdout.writ e('.')
sys.stdout.flus h()
conn.close()
return self.voidresp()
ftp = ftplib.FTP("FTP ADDRESS")
ftp.login("user ","pass")
file = "/file"
ftp.storbinary( "STOR " + file, open(file, "rb"), 1024)
ftp.quit()
Does anyone know why this is not working? IS there any other way to
find out when a chunc has been sent or the bytes uploaded of a file?
Thanks.
uplaod but couldn't get anything to work. After some more searching I
found
but it does not seem to work because it just uploads the file and does
not print a . onto the screen. HEre is the code I have when I'm using
the code from that link.
import ftplib
import os
class dot_FTP(ftplib. FTP):
def storbinary(self , cmd, fp, blocksize=8192) :
self.voidcmd('T YPE I')
conn = self.transfercm d(cmd)
while 1:
buf = fp.read(blocksi ze)
if not buf: break
conn.send(buf)
sys.stdout.writ e('.')
sys.stdout.flus h()
conn.close()
return self.voidresp()
ftp = ftplib.FTP("FTP ADDRESS")
ftp.login("user ","pass")
file = "/file"
ftp.storbinary( "STOR " + file, open(file, "rb"), 1024)
ftp.quit()
Does anyone know why this is not working? IS there any other way to
find out when a chunc has been sent or the bytes uploaded of a file?
Thanks.
Comment