Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt6 FTP
Forum Updated to NodeBB v4.3 + New Features

Qt6 FTP

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 6 Posters 4.3k Views 4 Watching
  • 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.
  • JKSHJ JKSH

    Qt 6 does not currently support FTP. See https://forum.qt.io/post/726965 for alternatives

    C Offline
    C Offline
    ChrisW67
    wrote on last edited by
    #4

    @JKSH Really? Wow.

    JKSHJ 1 Reply Last reply
    0
    • C ChrisW67

      @JKSH Really? Wow.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #5

      @ChrisW67 said in Qt6 FTP:

      @JKSH Really? Wow.

      Explained at https://forum.qt.io/post/713826

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

      1 Reply Last reply
      0
      • bigguinessB Offline
        bigguinessB Offline
        bigguiness
        wrote on last edited by
        #6

        Well this may blow a hole in my conversion to Qt6. Ugh...

        Why would they remove something as basic as FTP support? That doesn't make any sense.

        Grrr...

        Christian EhrlicherC D JKSHJ 3 Replies Last reply
        0
        • bigguinessB bigguiness

          Well this may blow a hole in my conversion to Qt6. Ugh...

          Why would they remove something as basic as FTP support? That doesn't make any sense.

          Grrr...

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #7

          @bigguiness said in Qt6 FTP:

          Why would they remove something as basic as FTP support? That doesn't make any sense.

          Because it's deprecated since the early Qt5 times and ftp is security flawed all over?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          bigguinessB 1 Reply Last reply
          0
          • C ChrisW67

            You can essentially follow the pattern in HTTP Example, providing an ftp: scheme URL in QNetworkRequest in place of an http: scheme URL.

            bigguinessB Offline
            bigguinessB Offline
            bigguiness
            wrote on last edited by
            #8

            @ChrisW67 I just tried the HTTP example. My target device does not even see the request.

            Still Ugh...

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @bigguiness said in Qt6 FTP:

              Why would they remove something as basic as FTP support? That doesn't make any sense.

              Because it's deprecated since the early Qt5 times and ftp is security flawed all over?

              bigguinessB Offline
              bigguinessB Offline
              bigguiness
              wrote on last edited by
              #9

              @Christian-Ehrlicher There are still a lot of embedded devices out there that run a FTP server.

              They are typically NOT connected to the internet so security should not really be a problem.

              For my case, the FTP server isn't even running on the normal FTP port 21. And it requires a username and password. And I don't care that these are passed as clear text. It's an embedded device, it's not connected to the internet, and the user already knows the username and password.

              1 Reply Last reply
              0
              • C ChrisW67

                You can essentially follow the pattern in HTTP Example, providing an ftp: scheme URL in QNetworkRequest in place of an http: scheme URL.

                bigguinessB Offline
                bigguinessB Offline
                bigguiness
                wrote on last edited by
                #10

                @ChrisW67 I was wrong, the HTTP Example is sending the request to my target device. But the device closes the connected instantly, probably due to no username/password. Not sure...

                The HTTP Example never shows the dialog to enter the username/password.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mchinand
                  wrote on last edited by
                  #11

                  @bigguiness said in Qt6 FTP:

                  The HTTP Example never shows the dialog to enter the username/password.

                  See @JKSH reply in the other FTP discussion; wrapping FTP cURL calls within QProcess may be a good approach to take if you want to use FTP with Qt6. Sometimes old protocols should be left to die (or upgraded as with SFTP).

                  1 Reply Last reply
                  0
                  • bigguinessB bigguiness

                    Well this may blow a hole in my conversion to Qt6. Ugh...

                    Why would they remove something as basic as FTP support? That doesn't make any sense.

                    Grrr...

                    D Offline
                    D Offline
                    DerReisende
                    wrote on last edited by
                    #12

                    @bigguiness you could use libcurl and this c++ ftp client

                    1 Reply Last reply
                    0
                    • bigguinessB bigguiness

                      Well this may blow a hole in my conversion to Qt6. Ugh...

                      Why would they remove something as basic as FTP support? That doesn't make any sense.

                      Grrr...

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #13

                      @bigguiness said in Qt6 FTP:

                      Well this may blow a hole in my conversion to Qt6

                      Why? Qt 6 itself doesn't currently contain an FTP class, but it's easy enough to use an alternative with Qt 6. See my link, or @DerReisende's link.

                      Why would they remove something as basic as FTP support?

                      Explained at https://forum.qt.io/post/713826

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

                      1 Reply Last reply
                      1
                      • bigguinessB Offline
                        bigguinessB Offline
                        bigguiness
                        wrote on last edited by
                        #14

                        This does not exactly do what I want, but...

                        https://github.com/zycliao/ftp-qt

                        The ftpClient project in that repo does compile and run with Qt 6.2.1 (after a bit of cleanup).

                        I just need to figure out a wan to use the client code to do a canned FTP get or put to download or upload a file without any user interaction.

                        Simplified steps (in my mind) are.

                        Get:

                        1. create the ftp get object
                        2. connect a signal / slot to let me know when the download is complete
                        3. set the login credentials (ip address, username, password)
                        4. connect to the FTP server
                        5. optionally, check the fetched file list to ensure that the file I want to "Get" exists
                        6. download the file
                        7. the signal / slot then lets me know when the download is complete and the ftp get object can be deleted

                        Put:

                        1. create the ftp put object
                        2. connect a signal / slot to let me know when the upload is complete
                        3. set the login credentials
                        4. connect to the FTP server
                        5. upload the file
                        6. the signal / slot then lets me know when the upload is complete and the ftp put object can be deleted

                        Anyone have some suggestions?

                        D 1 Reply Last reply
                        0
                        • bigguinessB bigguiness

                          This does not exactly do what I want, but...

                          https://github.com/zycliao/ftp-qt

                          The ftpClient project in that repo does compile and run with Qt 6.2.1 (after a bit of cleanup).

                          I just need to figure out a wan to use the client code to do a canned FTP get or put to download or upload a file without any user interaction.

                          Simplified steps (in my mind) are.

                          Get:

                          1. create the ftp get object
                          2. connect a signal / slot to let me know when the download is complete
                          3. set the login credentials (ip address, username, password)
                          4. connect to the FTP server
                          5. optionally, check the fetched file list to ensure that the file I want to "Get" exists
                          6. download the file
                          7. the signal / slot then lets me know when the download is complete and the ftp get object can be deleted

                          Put:

                          1. create the ftp put object
                          2. connect a signal / slot to let me know when the upload is complete
                          3. set the login credentials
                          4. connect to the FTP server
                          5. upload the file
                          6. the signal / slot then lets me know when the upload is complete and the ftp put object can be deleted

                          Anyone have some suggestions?

                          D Offline
                          D Offline
                          DerReisende
                          wrote on last edited by DerReisende
                          #15

                          @bigguiness if you look into client.cpp Client::upFile(…) for your Put operation you will find that the transfer is synchronous and there are no signals emitted.

                          bigguinessB 2 Replies Last reply
                          0
                          • D DerReisende

                            @bigguiness if you look into client.cpp Client::upFile(…) for your Put operation you will find that the transfer is synchronous and there are no signals emitted.

                            bigguinessB Offline
                            bigguinessB Offline
                            bigguiness
                            wrote on last edited by
                            #16

                            @DerReisende, adding a new signal and emitting it at the end of Client::upFile() should work.

                            The main problem I have is how to replace the ftpClient class with some generic "ftp" class to can the get/put of files.

                            1 Reply Last reply
                            0
                            • D DerReisende

                              @bigguiness if you look into client.cpp Client::upFile(…) for your Put operation you will find that the transfer is synchronous and there are no signals emitted.

                              bigguinessB Offline
                              bigguinessB Offline
                              bigguiness
                              wrote on last edited by
                              #17

                              @DerReisende, actually we do get a signal at the end of an upload.

                              connect(clientThread, SIGNAL(finished()), clientThread, SLOT(stop()));
                              

                              The upload starts the clientThread with the TUp task. ClientThread::run() then calls client->upFile() which returns once the upload is complete. That causes the thread to end and emit the finished() signal.

                              Currently ClientThread::stop() outputs a debug message then ensures that the thread is terminated.

                              1 Reply Last reply
                              0
                              • bigguinessB Offline
                                bigguinessB Offline
                                bigguiness
                                wrote on last edited by
                                #18

                                Well I got the ftp-qt ftpClient code to work the way I need it.

                                I rewrote the ftpClient class to remove all the ui interaction and changed the base class from QMainWindow to QObject.

                                I changed all the slot methods to public methods that my wrapper class can then call.

                                I wrote a ftpSession wrapper class for the ftpClient class. The wrapper class has methods to build a task list. Once the task list is created there is a method to start() running the tasks. As each task is completed by the ClientThread it emits a commandComplete() signal. The ftpSession then executes the next task in the list. The final task causes the ftpSession to emit a finished() signal that my main code uses to know that the session is complete.

                                It may be ugly but at least it works....

                                1 Reply Last reply
                                1

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved