1

I have projects that have to use FTP for file transfers. And all the projects are created with Qt 6.0.2.

The problem is, I can't upload any files to my FTP server. I tried it with Qt 5.15.2 and it all works fine, but whatever I try, I just couldn't success it with the Qt 6.0.2 version.

The error message is:

Protocol "ftp" is unknown

I researched all of the Qt documents, but I couldn't find any information about it.

Here is my code (working well with 5.15.2):

manager = new QNetworkAccessManager(this);

ftpAddress = "ftp://xxxx.net/";
ftpPort = 21;
username = "xxx";
password = "xxx";

QUrl ftpPath;
ftpPath.setUrl(ftpAddress);
ftpPath.setUserName(username);
ftpPath.setPassword(password);
ftpPath.setPort(ftpPort);

QNetworkRequest request;
request.setUrl(ftpPath);

downloadFileListReply = manager->get(request);
connect(downloadFileListReply, SIGNAL(finished()), this, SLOT(downloadFileListFinished()));

And a picture of the message box:

image

ka ra
  • 11
  • 2

1 Answers1

1

According to this blog post:

With Qt 6 we planned to move the ftp backend out of Qt Network and to distribute it separately as a plugin.

Now, it's not obvious where to get that plugin or how to load it, but there is some sample FTP client code here:

https://doc-snapshots.qt.io/qt6-dev/qtscxml-ftpclient-example.html

I found all this information via Google.

Paul Sanders
  • 15,937
  • 4
  • 18
  • 36