Solved [QNetworkAccessManager] retrieve a file with FTP
I want to retrieve a file from a server. I am using the class QNetworkAccessManager but I do not understant the function get(const QNetworkRequest &request). the function want an object of type QNetworkRequest but I do not understant how works the class QNetworkRequest
How can I use the command ftp : cd and get. I tryed to do :
QNetworkRequest request ; request.setUrl ( "cd /home/user/data get file.zip" ) ;
but It does not work.
Do you have a idea ?
Hi and welcome to devnet forums
Best is typically to checkout one of the example already or almost doing what try to implement.
There is the network download example being pretty close.
Typically you can also create a web path for ftp downloads in your browser (e.g. Chrome in my case). This path may be used as url for direct download. Best try it out with the example code provided. In case of problems post some questions in the forum or possibly it has been already asked before.
JKSH Moderators last edited by JKSH
@cosmoff said in [QNetworkAccessManager] retrieve a file with FTP:
request.setUrl ( "cd /home/user/data get file.zip" ) ;
The function is called
setUrl(), so you must enter a URL.
cdis not a URL.
Here are examples of URLs:
thanks for your answers.
I used the web path : request.setUrl("ftp://username:email@example.com/home/user/data/file.zip") and it works!
thank you again !