My goal is to upload a text file via HTTP post I am using Delphi 2009.
Say for example to the following URL
https://www.example.com/ex/exampleAPI.asmx/Process
I understand it can be done by using the TIdHttp component. And the following call
IdHttp1.Post();
But I cant figure out how to set up everything i.e. specifying the url and including the file to be posted.
Thanks.
TIdHTTP
has two overloaded versions ofPost()
that take a filename as input:.
Note that you are posting to an
HTTPS
URL, so you need to first assign an SSL-enabled IOHandler, such asTIdSSLIOHandlerSocketOpenSSL
, to theTIdHTTP.IOHandler
property beforehand.