Help FTP upload

Gilles Lenfant glenfant at equod.com.nospam
Fri Nov 10 17:12:47 EST 2000


Hi,

I try to make an FTP upload (Python 1.5.2/Win32) to a ProFTPD/Linux server:

ftps = ftplib.FTP('ahost', 'anuser', 'apasswd')
...
filename = 'anyfile.foo'
bufsize = 1024
fh = open(filename, 'r')
ftps.set_debuglevel(1)
ftps.storbinary('STOR %s' % filename, fh, bufsize)
ftps.set_debuglevel(0)
file.close()
ftps.quit()

This seems to work till then cause no exception is raised and the console
output due to debuglevel displays:

*cmd* 'TYPE I'
*resp* '200 Type set to I.'
*cmd* 'PORT 192,168,1,39,11,161'
*resp* '200 PORT command successful.'
*cmd* 'STOR anyfile.foo'
*resp* '150 Opening BINARY mode data connection for anyfile.foo.'
*resp* '226 Transfer complete.'

But the file in the FTP server is corrupted and smaller than the original
one.
When I upload with an usual FTP client, it works correctly.




More information about the Python-list mailing list