You are not logged in.
Pages: 1
I need to send a zip file to a rest service as http(s) post with content-type multipart/form-data. The rest service will return json data to indicate success/failure.
I found this forum post: http://synopse.info/forum/viewtopic.php?id=2366 but is there any documentation on how to use it or perhaps a small example?
Offline
In end-user code, you should use TSQLRestServerURIContext.InputAsMultiPart in a method-based service.
See http://synopse.info/files/html/api-1.18 … C_436B0FC2
Offline
Thanks but I don't understand how this relates to the TWinHttp.Post request that I'd like to send:
SetLength(MultiPart, 1);
MultiPart[0].Name := 'file';
MultiPart[0].FileName := ExtractFileName(Filename);
MultiPart[0].ContentType := 'application/octet-stream';
MultiPart[0].Encoding := 'UTF8';
MultiPart[0].Content := Body;
ctx := TSQLRestServerURIContext.Create;
ctx.InputAsMultiPart(MultiPart);
// what to do to send with TWinHttp.Post ?
Offline
Oh - I did not understand your exact question.
I though your were talking about the server part.
There is no multi-part mime encoding for the client yet in SynCrtSock.pas.
So you would have to use Indy or Synapse to compute the body, then send it via TWinHttp.Post().
Offline
Pages: 1