Hallo Leute,
ich habe ein Problem, ich habe mit dem
Indy-
FTP Client
ein Proggeschrieben, was eine Datei auf nen Server kopiert.
Leider bekomme ich immer bei der Anweisung
Connect;
eine
Exception.
Woran liegt mein Fehler?
Hier der Code:
Delphi-Quellcode:
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP, ComCtrls;
type
TForm1 = class(TForm)
IdFTP1: TIdFTP;
OpenDialog1: TOpenDialog;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
ProgressBar1: TProgressBar;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure IdFTP1Connected(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
procedure IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
procedure IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
private
{ Private-Deklarationen }
filename: string;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
OpenDialog1.Execute;
Label1.Caption := OpenDialog1.FileName;
filename := OpenDialog1.FileName;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
idFTP1.Connect;
idFTP1.Login;
end;
procedure TForm1.IdFTP1Connected(Sender: TObject);
begin
idFTP1.ChangeDir('/web/data/news/test');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
idFTP1.Put(filename);
end;
procedure TForm1.IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
begin
ProgressBar1.Max := AWorkCountMax;
ProgressBar1.Position := 0;
end;
procedure TForm1.IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
begin
ProgressBar1.Position := AWorkCount;
end;
procedure TForm1.IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
ProgressBar1.Position := 0;
end;
end.