httppostfile.pp 491 B

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