How do I upload a file using http post? Delphi 2009 -


my goal upload text file via http post using delphi 2009.

say example following url

https://www.example.com/ex/exampleapi.asmx/process

i understand can done using tidhttp component. , following call

idhttp1.post(); 

but cant figure out how set i.e. specifying url , including file posted.

thanks.

tidhttp has 2 overloaded versions of post() take filename input:

var   response: string;  response := idhttp1.post('https://www.example.com/ex/exampleapi.asmx/process', 'c:\filename.txt'); 

.

var   response: tstream;  response := tmemorystream.create; idhttp1.post('https://www.example.com/ex/exampleapi.asmx/process', 'c:\filename.txt', response); ... response.free; 

note posting https url, need first assign ssl-enabled iohandler, such tidssliohandlersocketopenssl, tidhttp.iohandler property beforehand.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -