On 2018-04-07 10:13, Graeme Geldenhuys wrote: > Have you tried this? > > http://lmgtfy.com/?q=delphi+indy+sending+file+via+http+post > > I see many answers listed there. ;-)
And if you are really lazy... ;-) Indy has TIdMultipartFormDataStream for this purpose: procedure TForm1.SendPostData; var Stream: TStringStream; Params: TIdMultipartFormDataStream; begin Stream := TStringStream.Create(''); try Params := TIdMultipartFormDataStream.Create; try Params.AddFile('File1', 'C:\test.txt','application/octet-stream'); try HTTP.Post('http://posttestserver.com/post.php', Params, Stream); except on E: Exception do ShowMessage('Error encountered during POST: ' + E.Message); end; ShowMessage(Stream.DataString); finally Params.Free; end; finally Stream.Free; end; end; That will sent a file to the PHP script on the server. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal