Hi everybody!
I'm trying to use QNetworkManagerAccess to upload a file. I've created a prototype (Python):
def run(self):
print "Starting thread"
self.manager = QNetworkAccessManager();
self.manager.finished.connect(self.finished)
print "Opening file"
self.
f = QFile("/home/divius/test.tbz2") self.
request = QNetworkRequest
(QUrl( "ftp://ibdftp:111111@127.0.0.1/test.tbz2"))
print "Putting request"
self.manager.put(self.request, self.f)
print "Executing"
code = self.exec_()
print "Done:", code
def finished(self, reply):
print "Finished", reply.error(), reply.error() == QNetworkReply.NoError
self.quit()
class Thread(QThread):
def run(self):
print "Starting thread"
self.manager = QNetworkAccessManager();
self.manager.finished.connect(self.finished)
print "Opening file"
self.f = QFile("/home/divius/test.tbz2")
self.f.open(QIODevice.ReadOnly)
self.request = QNetworkRequest(QUrl(
"ftp://ibdftp:111111@127.0.0.1/test.tbz2"))
print "Putting request"
self.manager.put(self.request, self.f)
print "Executing"
code = self.exec_()
print "Done:", code
def finished(self, reply):
print "Finished", reply.error(), reply.error() == QNetworkReply.NoError
self.quit()
To copy to clipboard, switch view to plain text mode
Still, I get error 201 (QNetworkReply::ContentAccessDenied).
Syslog contains:
May 17 13:55:17 divius-pc wu-ftpd[31399]: connection from localhost [127.0.0.1]
May 17 13:55:17 divius-pc wu-ftpd[31399]: USER ibdftp
May 17 13:55:17 divius-pc wu-ftpd[31399]: PASS password
May 17 13:55:17 divius-pc wu-ftpd[31399]: FTP LOGIN FROM localhost [127.0.0.1], ibdftp
May 17 13:55:17 divius-pc wu-ftpd[31399]: TYPE Image
May 17 13:55:17 divius-pc wu-ftpd[31399]: PASV
May 17 13:55:17 divius-pc wu-ftpd[31399]: ALLO 10723805
May 17 13:55:17 divius-pc wu-ftpd[31399]: STOR /test.tbz2
May 17 13:55:18 divius-pc wu-ftpd[31399]: FTP session closed
Tested with wu-ftpd, proftpd and simple ftpd.
Any ideas?
Bookmarks