Got a minute? We appreciate your feedback:
- last edited on
I am trying to upload file as multipart/form-data using clientconnection. But it failed.
This is my code.
void ExportIFC::ExportData(const char* buffer, UINT32 size)
using namespace HTTP::Client;
using namespace HTTP::MessageHeader;
using namespace HTTP::Encoding;
GS::UniString url = "/upload/" + this->m_projectId + "/" + this->m_uploadHandle;
Request postRequest(Method::Post, url);
RequestHeaderFieldCollection& headers = postRequest.GetRequestHeaderFieldCollection();
GS::UniString bearer = "bearer " + this->m_token;
headers.Add("Content-Disposition", "form-data; name=\"file\"; filename=\"test.ifc\"");
BodyOBinaryChannel& outChannel = clientConnection.BeginSend(postRequest);
StatusCode::Id code = response.GetStatusCode();
if (code == StatusCode::OK)
// post process
What is my fault? Please help me.
Don't you need a clientConnection.FinishSend(); ?
Hey! Was you able to achieve this? I'm trying it too, with clientConnection.FinishSend(), but I'm getting some errors from the server, maybe due how I'm writing. Shouldn't boundaries be written?
Hi,I could not to upload the file with clientconnection.So I solved the problem using cURL.
Nice! I solved as well, but using libcpr (a curl wrapper that is very wasy to use)