HTTP POST - HTML FORM Submission Data (Using CHTTPFormEncoder)
| Fri, 2005-06-03 05:22 | |
|
Hello,
I am able to successfully post a picture to the server ( just binary) using the following code. Code: case EClientPost: Now I want to post both text (xml) and binary ( image) so I am trying to put them{ // Issue HTTP post to engine iClient->CancelTransaction(); // URL to post the picture TBuf8<256> uri8; uri8.Copy(KTestURL); TBuf<50> aFileName = _L("c:\\image.jpg"); // 30KB Image to be uploaded HBufC8* postData8 = ReadFileLC(aFileName); // Start transaction iClient->IssueHTTPPostL(uri8, _L8("*/*"), *postData8); } into a CHTTPFormEncoder ( name-value pairs). This is how I try to do it. Code: TBuf<50> aFileName1 = _L("c:\\xml.txt"); // XML control message TBuf<50> aFileName2 = _L("c:\\image.jpg"); // 30KB Image to be uploaded HBufC8* xml_part = ReadFileLC(aFileName1); HBufC8* binary_part = ReadFileLC(aFileName2); // Start transaction iClient->IssueHTTPPostL(uri8, _L8("application/x-www-form-urlencoded"), *xml_part, *binary_part); Now in the IssueHTTPPostL() method - I need to combine the 2 data in to name-value pairs CHTTPFormEncoder* postData8; // = CHTTPFormEncoder::NewL(); postData8->AddFieldL(_L8("xml"),*xml_part); postData8->AddFieldL(_L8("file_upload"), *binary_part); |
|






Forum posts: 3
Thanks.
Forum posts: 59