Closed Timothyoverton closed 8 years ago
Try to copy the TIdMultiPartFormDataStream to a TMemoryStream and remember to set the correct Content-Type
header. Then post it. The result will be a string.
Something like this:
data := TIdMultiPartFormDataStream.Create;
content := TMemoryStream.Create;
try
with data.AddFile('doc', 'test.txt', '') do
begin
HeaderCharset := 'utf-8';
HeaderEncoding := '8';
end;
content.CopyFrom(data, 0);
s := restclient.Resource('http://localhost/documents')
.ContentType(data.RequestContentType)
.Post(content);
finally
data.free;
content.free;
end;
Right! That looks promising I'll give it a try - thanks!
Hi Guys,
I'm still trying to integrate your rest client. I have 1 last hurdle.
We are uploading a file in chunks using TIdMultipartFormDataStream and TIdHttp from Indy, we are making a post for each chunk that is uploaded. Is this possible to do this with WinHTTP and your wrapper?
Thanks, Tim