PDA

View Full Version : QNetworkManagerAccess: fails to upload file to FTP via put()



divius
17th May 2010, 11:07
Hi everybody!

I'm trying to use QNetworkManagerAccess to upload a file. I've created a prototype (Python):



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()


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?

divius
17th May 2010, 11:10
If it's important: Ubuntu 10.04, Qt 4.6.2

gurpal2000
20th May 2013, 20:34
hi did you work out the solution? if so, please share code
thanks

ChrisW67
21st May 2013, 01:23
At a guess the FTP server is denying permission to write the uploaded file into the FTP server's "root" directory (which may be the system's root directory or a virtual one).

There are some issues with parsing of FTP URLs that were recently discussed in this forum.