unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP, StdCtrls, ComCtrls, IdAntiFreezeBase, IdAntiFreeze;
type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button2: TButton;
Edit4: TEdit;
Label4: TLabel;
SpeedButton1: TSpeedButton;
Label6: TLabel;
Button3: TButton;
Label5: TLabel;
ProgressBar1: TProgressBar;
IdAntiFreeze1: TIdAntiFreeze;
StatusBar1: TStatusBar;
IdFTP1: TIdFTP;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
procedure IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
procedure IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button3Click(Sender: TObject);
procedure IdFTP1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: String);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
idFTP1.Username := Edit1.Text;
idFTP1.Password := Edit2.Text;
idFTP1.Host := Edit3.Text;
idFTP1.Port := 21;
sleep(100);
idFTP1.Connect;
idFTP1.Put(Edit4.Text, ExtractFileName(Edit4.Text));
idFTP1.Disconnect;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
OpenDialog1.Execute;
Edit4.Text := OpenDialog1.FileName;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ProgressBar1.Position := 0;
end;
procedure TForm1.IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
begin
ProgressBar1.Max := AWorkCountMax;
end;
procedure TForm1.IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
begin
ProgressBar1.Position := AWorkCount;
Application.ProcessMessages;
end;
procedure TForm1.IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
ProgressBar1.Position := 0;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
idFTP1.Free;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label6.Caption := '';
end;
procedure TForm1.IdFTP1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: String);
begin
Statusbar1.SimpleText := AStatusText;
end;
end.