How to get a list of files from a ftp server
Solved
QML and Qt Quick
-
Hi.
I need to get a list of files from a ftp server.
I think if I can use "LIST" command, get a list of files.
but I don't know how.manager = new QNetworkAccessManager; // get is no problem. //QNetworkReply *pReply = manager->get(QNetworkRequest("ftp://myftpserveraddress/test.txt")); //↓not working. error message is "Protocol "ftp" is unknown" //QBuffer buffer; //QNetworkReply *pReply = manager->sendCustomRequest(QNetworkRequest("ftp://myftpserveraddress/"),"LIST", &buffer);
How should I do?
thanks. -
Which version of Qt do you use?
If you use version below 5 you can use Qftp but if you use version 5 or upper, you can use Qt FTP add-on module that's provided for Qt 5.Qt 5 change log:
The QFtp and QUrlInfo classes are no longer exported. Use QNetworkAccessManager instead. Programs that require raw FTP or HTTP streams can use the Qt FTP and Qt HTTP compatibility add-on modules that provide the QFtp and QHttp classes as they existed in Qt 4.