[Qt-interest] HTTP post of several files' data
Steven Doerfler
sgd-qt at lugaru.com
Thu Mar 4 06:23:45 CET 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100304/e66fa1b3/attachment.html
More information about the Qt-interest-old
mailing list