O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Downloading files over FTP

Downloading a file over FTP is as simple as downloading files over HTTP. If it is an anonymous FTP server for which you do not need an authentication, just use the URL as we did before. Assuming that there is again a file called version.txt on the FTP server on the localhost, type this:

m_network_manager->get(QNetworkRequest(    QUrl("ftp://localhost/version.txt"))); 

That's all; everything else stays the same. If the FTP server requires an authentication, you'll get an error; consider this example:

Likewise, setting the username and password to access an FTP server is easy—either write it in the URL, or use the setUserName() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required