By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

resume upload

P: n/a

How can i resume a partial upload using ftplib ?
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
probably by using REST. This stupid program puts a 200 line file by
sending 100 lines, then using REST to set a resume position and sending
the next 100 lines.

import getpass, StringIO, ftplib

lines = ["Line %d\n" % i for i in range(200)]
part1 = "".join(lines[:100])
part2 = "".join(lines[:100])

f = ftplib.FTP('server', 'username', 'password')
f.debugging = True
f.sendcmd('CWD /tmp')
f.storbinary("STOR example", StringIO.StringIO(part1))
f.putcmd('REST %d' % len(part1))
resp = f.getresp();
if resp[0] != '3': raise ftplib.error_reply, resp
f.storbinary("STOR example", StringIO.StringIO(part2))

Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFCys+lJd01MZaTXX0RAll+AJ4nGsvlUSox7mT9PzOLg8 tofHv+qACfXByv

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.