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. Upload file to server via https
Forum Updated to NodeBB v4.3 + New Features

Upload file to server via https

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 759 Views 2 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.
  • X Offline
    X Offline
    xbasista
    wrote on 22 Jun 2021, 14:45 last edited by
    #2
    This post is deleted!
    1 Reply Last reply
    0
    • X xbasista
      22 Jun 2021, 14:34

      Hello,

      i'm new in QT and i do not know how to send file to server. I have url like:
      "https://www.example.com/?import=data=&DATA&",
      where &DATA& is that file.

      i need something like:

      request("https://www.example.com/?import=data=&DATA&");
      
      respond = respond();
      qDebug << respond;
      

      Is is possible?

      J Offline
      J Offline
      JonB
      wrote on 22 Jun 2021, 15:11 last edited by JonB
      #3

      @xbasista
      From that URL I don't think it takes a file to upload. Rather I suspect you have to supply the data/content of the file where shown on the URL?

      You can use QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request) to make the URL request you show.

      1 Reply Last reply
      3
      • X xbasista
        22 Jun 2021, 14:34

        Hello,

        i'm new in QT and i do not know how to send file to server. I have url like:
        "https://www.example.com/?import=data=&DATA&",
        where &DATA& is that file.

        i need something like:

        request("https://www.example.com/?import=data=&DATA&");
        
        respond = respond();
        qDebug << respond;
        

        Is is possible?

        A Offline
        A Offline
        artwaw
        wrote on 22 Jun 2021, 15:14 last edited by
        #4

        @xbasista
        https://doc.qt.io/qt-5/qnetworkaccessmanager.html

        https://doc.qt.io/qt-5/qnetworkrequest.html

        https://doc.qt.io/qt-5/qnetworkreply.html

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply
        3
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 22 Jun 2021, 16:11 last edited by
          #5

          Hi and welcome to devnet,

          Beside the good points of my fellow, depending on your OS ensure that you have OpenSSL available as well.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xbasista
            wrote on 25 Jun 2021, 07:57 last edited by xbasista
            #6

            Thanks,

            @JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.

            Does anyone know where the problem might be?

            J J 2 Replies Last reply 25 Jun 2021, 08:00
            0
            • X xbasista
              25 Jun 2021, 07:57

              Thanks,

              @JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.

              Does anyone know where the problem might be?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 25 Jun 2021, 08:00 last edited by
              #7

              @xbasista said in Upload file to server via https:

              Does anyone know where the problem might be?

              You should add error handling to your code to see what happens.
              https://doc.qt.io/qt-5/qnetworkreply.html#errorOccurred

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

              1 Reply Last reply
              1
              • X xbasista
                25 Jun 2021, 07:57

                Thanks,

                @JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.

                Does anyone know where the problem might be?

                J Offline
                J Offline
                JonB
                wrote on 25 Jun 2021, 08:05 last edited by JonB
                #8

                @xbasista
                As Per @jsulm, you should always add error handling to your code. Since you are trying to access an https, at a guess you do not have the necessary Qt OpenSSL requirements on one machine.

                J 1 Reply Last reply 25 Jun 2021, 08:07
                2
                • J JonB
                  25 Jun 2021, 08:05

                  @xbasista
                  As Per @jsulm, you should always add error handling to your code. Since you are trying to access an https, at a guess you do not have the necessary Qt OpenSSL requirements on one machine.

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 25 Jun 2021, 08:07 last edited by
                  #9

                  @JonB @xbasista https://doc.qt.io/qt-5/qnetworkaccessmanager.html#sslErrors

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

                  1 Reply Last reply
                  2
                  • X Offline
                    X Offline
                    xbasista
                    wrote on 25 Jun 2021, 13:07 last edited by
                    #10

                    @jsulm
                    I added to my code and i found out that on another pc is not openssl support [ QSslSocket::supportsSsl() ].
                    I read that https://stackoverflow.com/questions/20351155/how-can-i-enable-ssl-in-qt-windows-application and i think i need libeay32.dll and ssleay32.dll libs. The problem is i do not know where can i found that files? They shloud be in openSSL folder/bin but i don't have that folder.

                    Output on build pc:

                    SslSupport:  true
                    SslLibraryBuildVersion:  "OpenSSL 1.1.1g  21 Apr 2020"
                    SslLibraryRuntimeVersion:  "OpenSSL 1.1.1k  25 Mar 2021"
                    

                    Output on another pc:

                    SslSupport:  
                    SslLibraryBuildVersion:  "OpenSSL 1.1.1g  21 Apr 2020"
                    SslLibraryRuntimeVersion:  
                    
                    1 Reply Last reply
                    0
                    • X Offline
                      X Offline
                      xbasista
                      wrote on 25 Jun 2021, 14:04 last edited by xbasista
                      #11

                      I found out that:

                      "
                      For ssl 1.0.x (qt<5.12.4) you are likely missing libeay32.dll and ssleay32.dll.

                      For ssl 1.1.x (qt>=5.12.4) binary compatibility broke (qt 5.12.4 released), so you might need libssl-1_1.dll and libcrypto-1_1.dll, and its dependencies capi.dll and dasync.dll.
                      "

                      So i import libssl-1_1-x64.dll and libcrypto-1_1-x64.dll from my openssl and everything working.

                      Thanks

                      1 Reply Last reply
                      0

                      11/11

                      25 Jun 2021, 14:04

                      • Login

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