Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QT6 Protocol "ftp" is unknown

Tags:

c++

qt

ftp

qt6

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

like image 748
ka ra Avatar asked Mar 08 '26 16:03

ka ra


1 Answers

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.

like image 174
Paul Sanders Avatar answered Mar 11 '26 07:03

Paul Sanders