Урок на Делфи 64. Скачать файл по http протоколу


задание на delphi. Как загрузить файл по http

unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 = class(TForm)
Button1: TButton;
IdHTTP1: TIdHTTP;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
mfile:TMemoryStream;
url:string;
begin
mfile:=TMemoryStream.Create;
url:='http://wallpapers-images.ru/1920x1080/mountains/wallpapers/mountains-wallpapers-1920x1080-0007.jpg';
IdHTTP1.Get(url,mfile);
mfile.SaveToFile('c:\temp\file.jpg');
FreeAndNil(mfile);
end;
end.



Скачать