Symbian C++ Multipart/form-data
2010-09-16 00:02:00 来源:WEB开发网Submit the transaction
RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();AddHeaderL(hdr, HTTP::EUserAgent, KUserAgent);AddHeaderL(hdr, HTTP::EAccept, KAccept);AddHeaderL(hdr, HTTP::EContentType, KPostContentType); MHTTPDataSupplier* dataSupplier = this;iTransaction.Request().SetBody(*dataSupplier); iTransaction.SubmitL();
Implement DataSupplier functions
TBool CHTTPExampleEngine::GetNextDataPart(TPtrC8& aDataPart){ TBool retVal = EFalse; aDataPart.Set(iPostData->Des()); retVal = (aDataPart.Length() == 0); iDataAvailable=retVal; return retVal;} TInt CHTTPExampleEngine::OverallDataSize(){ if(iPostData) return iPostData->Length(); else return KErrNotFound ;} void CHTTPExampleEngine::ReleaseData(){ if(iDataAvailable) iTransaction.NotifyNewRequestBodyPartL();}
Any binary file can be uploaded with this upload code.
赞助商链接