httppostfile.pp 465 B

12345678910111213141516171819202122232425262728
  1. program httppostfile;
  2. {$mode objfpc}{$H+}
  3. uses
  4. SysUtils, Classes, fphttpclient, opensslsockets;
  5. Var
  6. F : TFileStream;
  7. Vars : TStrings;
  8. i : integer;
  9. begin
  10. With TFPHTTPClient.Create(Nil) do
  11. begin
  12. F:=TFileStream.Create('response.html',fmCreate);
  13. try
  14. Vars:=TstringList.Create;
  15. try
  16. FileFormPost(ParamStr(1),'myfile',paramstr(2),f);
  17. finally
  18. Vars.Free;
  19. end;
  20. finally
  21. F.Free;
  22. end;
  23. end;
  24. end.