I'm trying to upload a file using ftplib in Python.
ftp = FTP('...')
ftp.login('user', 'pass')
f = open(filename)
ftp.storbinary(filename, f)
f.close()
ftp.quit()
storbinary is returning error_perm: 500 Unknown command.
, which is strange since I'm following its specification. Google search returns very little information. Anyone encountered this problem ?
It looks like you're using storbinary
incorrectly. You want to pass "STOR filename-at-location", f)
to send the file. Does this work?
ftp = FTP('...')
ftp.login('user', 'pass')
with open(filename) as contents:
ftp.storbinary('STOR %s' % filename, contents)
ftp.quit()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With