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. How to access the data received from FTP server?

How to access the data received from FTP server?

Scheduled Pinned Locked Moved Solved General and Desktop
qt creator
5 Posts 3 Posters 761 Views
  • 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.
  • K Offline
    K Offline
    kayakaan02
    wrote on last edited by
    #1

    Hi, I've been using this(https://doc.qt.io/qt-6/qtscxml-ftpclient-example.html) ftp client to receive data from ftp server and it's working as intended.

    It displays the text inside the txt file in application output.

    But my question here is how can I access it? Where is it stored? I want to write it to some other file.

    Actually I want to get an xml file from ftp client and save it to my computer that's my purpose.

    Thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • K kayakaan02

      Hi, I've been using this(https://doc.qt.io/qt-6/qtscxml-ftpclient-example.html) ftp client to receive data from ftp server and it's working as intended.

      It displays the text inside the txt file in application output.

      But my question here is how can I access it? Where is it stored? I want to write it to some other file.

      Actually I want to get an xml file from ftp client and save it to my computer that's my purpose.

      Thanks in advance.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @kayakaan02 This is the place where data is received:

      QObject::connect(&dataChannel, &FtpDataChannel::dataReceived,
                           [](const QByteArray &data) {
              std::cout << data.constData() << std::flush;
          });
      

      Instead of simply printing it out you can accumulate the data returned by data.constData() in a member variable of type QByteArray. When the whole file was transferred you will have all the data in that member variable.
      Keep in mind that you should not do it this way if transferred file is big. In this case you can write what data.constData() returns into a file.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • K Offline
        K Offline
        kayakaan02
        wrote on last edited by
        #3

        @jsulm Thanks, how did I not see that :D.

        Also I assume I cannot take this as a file and directly save it?

        I have to take what I have and save it into a file so that means more work?

        M jsulmJ 2 Replies Last reply
        0
        • K kayakaan02

          @jsulm Thanks, how did I not see that :D.

          Also I assume I cannot take this as a file and directly save it?

          I have to take what I have and save it into a file so that means more work?

          M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4

          @kayakaan02
          nothing prevents you from saving the bytearray directly to a file.

          1 Reply Last reply
          1
          • K kayakaan02

            @jsulm Thanks, how did I not see that :D.

            Also I assume I cannot take this as a file and directly save it?

            I have to take what I have and save it into a file so that means more work?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @kayakaan02 said in How to access the data received from FTP server?:

            Also I assume I cannot take this as a file and directly save it?

            Of course you can. I also wrote it in my previous post...

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

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