Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved [QNetworkAccessManager] retrieve a file with FTP

    General and Desktop
    3
    4
    1150
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cosmoff last edited by

      Hello everybody,

      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 ?

      thanks.

      K JKSH 2 Replies Last reply Reply Quote 0
      • K
        koahnig @cosmoff last edited by

        @cosmoff

        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.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 3
        • JKSH
          JKSH Moderators @cosmoff 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. cd is not a URL.

          Here are examples of URLs:

          • http://www.qt.io/
          • ftp://127.0.0.1/files/

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply Reply Quote 3
          • C
            cosmoff last edited by

            thanks for your answers.

            I used the web path : request.setUrl("ftp://username:password@192.168.0.250/home/user/data/file.zip") and it works!

            thank you again !

            1 Reply Last reply Reply Quote 1
            • First post
              Last post