[Qt-interest] HTTP post of several files' data

Qt Quest qt.quest at yahoo.com
Thu Mar 4 11:49:51 CET 2010


Hi Steven,
Your solution is very elegant - I'm using it. The requests seem valid, but for some reason the Tomcat Servlet server I'm using says all the parameters (strings and files) are null - so it may be a problem with Tomcat/Servlets.
Thanks for your help! :-)

--- On Thu, 3/4/10, Steven Doerfler <sgd-qt at lugaru.com> wrote:

From: Steven Doerfler <sgd-qt at lugaru.com>
Subject: Re: [Qt-interest] HTTP post of several files' data
To: qt-interest at trolltech.com
Date: Thursday, March 4, 2010, 5:23 AM




  
  
On 3/3/2010 9:15 PM, Qt Quest wrote:

  
    
      
        I'm trying to write an HTTP POST code which will upload
several files in the same request.

However, I do not know understand how to delimit each file parameter,
since '&' could be in the body of the files.

What is the proper way to do it? base64? Should I set any request
headers?

Below is the code I currently use. No HTTP headers are being set up.

        
      
    
  



You have to generate a unique boundary string, then send it in the
multipart/form-data header.  Then each file needs its own header block
within the overall message.  It's a bit involved.



It looks like Qt
doesn't include any built-in class to prepare POST requests.  Consider
using the Form Post plugin at http://www.tuckdesign.com/sources/Qt , or
at least examine the method it uses to construct a POST request when
you use its addFile function.



Steven



 

-----Inline Attachment Follows-----

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100304/839e834e/attachment.html 


More information about the Qt-interest-old mailing list