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. Post upload file send only 16kb
Qt 6.11 is out! See what's new in the release blog

Post upload file send only 16kb

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 5 Posters 3.6k Views 3 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.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #13

    Check for limits on the server you are posting to. Does other software allow you to post bigger files? We have a server we wrote in python that had a limit of 40MB. It was a self imposed limit.

    C++ is a perfectly valid school of magic.

    V 1 Reply Last reply
    0
    • fcarneyF fcarney

      Check for limits on the server you are posting to. Does other software allow you to post bigger files? We have a server we wrote in python that had a limit of 40MB. It was a self imposed limit.

      V Offline
      V Offline
      vicsoftware
      wrote on last edited by
      #14

      @fcarney Any files with any libraries. But not Qt. May be it is bug?

      1 Reply Last reply
      0
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #15

        Looks like some sort of config limit:
        https://doc.qt.io/qt-5/qnetworkrequest.html#http2Configuration

        C++ is a perfectly valid school of magic.

        V 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Did you also check that your headers are all correct ?

          V Offline
          V Offline
          vicsoftware
          wrote on last edited by vicsoftware
          #16

          @SGaist I think yes. I tried many combinations. I compare headers from curl and python requests and they works. May be Qt network engine needs additional headers, but it is abnormal.

          Now it works with curl cpp wrapper in same class in same function without any problems.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #17

            Did you try following the example of QHttpMultiPart ? Adding only the minimal set of headers like the authentication and nothing else ?

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

            V 1 Reply Last reply
            0
            • fcarneyF fcarney

              Looks like some sort of config limit:
              https://doc.qt.io/qt-5/qnetworkrequest.html#http2Configuration

              V Offline
              V Offline
              vicsoftware
              wrote on last edited by vicsoftware
              #18

              @fcarney Tried:

              QHttp2Configuration conf = request.http2Configuration();
              conf.setMaxFrameSize( 100 * 1024 * 1024 );
              request.setHttp2Configuration( conf );
              

              And got this:

              Upload...
              qt.network.http2: Maximum frame size to advertise is invalid
              Upload success.
              16384 27025
              16384 27025
              27025 27025
              0 0
              Upload finished.
              
              10 Mb file
              
              Upload...
              qt.network.http2: Maximum frame size to advertise is invalid
              Upload success.
              16384 10669810
              16384 10669810
              16384 10669810
              16384 10669810
              Upload error code: 2
              0 0
              Upload finished.
              Upload error: Connection closed
              
              

              It is something new.

              And it is also very slow.

              1 Reply Last reply
              0
              • SGaistS SGaist

                Did you try following the example of QHttpMultiPart ? Adding only the minimal set of headers like the authentication and nothing else ?

                V Offline
                V Offline
                vicsoftware
                wrote on last edited by
                #19

                @SGaist Yes, i did all Googled combinations to upload file via QT nm.post, including qtmultipart examples from stackoverflow. Always failed.

                1 Reply Last reply
                0
                • fcarneyF Offline
                  fcarneyF Offline
                  fcarney
                  wrote on last edited by
                  #20

                  I just looked at some code we use. It uses multipart and we can send files larger than 16KB. I cannot share it though.

                  C++ is a perfectly valid school of magic.

                  V 1 Reply Last reply
                  0
                  • fcarneyF Offline
                    fcarneyF Offline
                    fcarney
                    wrote on last edited by
                    #21

                    Also, for size we use QVariant(device->size()) in the content header content length. Not sure if that would make a difference. I believe size is an integer of some type.

                    C++ is a perfectly valid school of magic.

                    V 1 Reply Last reply
                    0
                    • fcarneyF fcarney

                      Also, for size we use QVariant(device->size()) in the content header content length. Not sure if that would make a difference. I believe size is an integer of some type.

                      V Offline
                      V Offline
                      vicsoftware
                      wrote on last edited by vicsoftware
                      #22

                      @fcarney Tried that:

                      request.setHeader( QNetworkRequest::ContentLengthHeader, QVariant{ m_requestFile->size() } );
                      request.setHeader( QNetworkRequest::ContentTypeHeader, QVariant{ "image/jpeg" } );
                      

                      Same bug.

                      May be QT developers can help?

                      fcarneyF 1 Reply Last reply
                      0
                      • fcarneyF fcarney

                        I just looked at some code we use. It uses multipart and we can send files larger than 16KB. I cannot share it though.

                        V Offline
                        V Offline
                        vicsoftware
                        wrote on last edited by
                        #23

                        @fcarney I tried multipart. But we need several headers and file contents only. Without parsing parts and boundaries on server side cause server save all data to file.

                        1 Reply Last reply
                        0
                        • V vicsoftware

                          @fcarney Tried that:

                          request.setHeader( QNetworkRequest::ContentLengthHeader, QVariant{ m_requestFile->size() } );
                          request.setHeader( QNetworkRequest::ContentTypeHeader, QVariant{ "image/jpeg" } );
                          

                          Same bug.

                          May be QT developers can help?

                          fcarneyF Offline
                          fcarneyF Offline
                          fcarney
                          wrote on last edited by
                          #24

                          @vicsoftware said in Post upload file send only 16kb:

                          request.setHeader( QNetworkRequest::ContentTypeHeader, QVariant{ m_requestFile->size() } );
                          request.setHeader( QNetworkRequest::ContentLengthHeader, QVariant{ "image/jpeg" } );

                          Are you really setting length to "image/jpeg"? And type to size?

                          C++ is a perfectly valid school of magic.

                          V 1 Reply Last reply
                          0
                          • fcarneyF fcarney

                            @vicsoftware said in Post upload file send only 16kb:

                            request.setHeader( QNetworkRequest::ContentTypeHeader, QVariant{ m_requestFile->size() } );
                            request.setHeader( QNetworkRequest::ContentLengthHeader, QVariant{ "image/jpeg" } );

                            Are you really setting length to "image/jpeg"? And type to size?

                            V Offline
                            V Offline
                            vicsoftware
                            wrote on last edited by
                            #25

                            @fcarney Sorry, I'm tired. Fixed. Tried both ). Same result.

                            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