-1
我是delphi的新手,我需要編寫一個ftp客戶端程序,它將通過一個帶有ftp地址列表的文本文件,並從ftp站點下載子文件夾。 我已成功掛接到服務器,但卡在下載部分。可有人請幫助我的代碼下載過程使用Delphi IdFTP下載FTP文件
procedure TCleint.btnConnectClick(Sender: TObject);
begin
try
if not IdFTP.Connected then
begin
IdFTP.Host := 'ftp server';
IdFTP.Username := 'anonymous';
IdFTP.Password := 'emailaddress';
IdFTP.Port := 21;
IdFTP.Connect;
IdFTP.List(listaDirectory.Items, '', false);
btnConnect.Enabled := False;
btnDisconnect.Enabled := True;
btnDownload.Enabled := True;
end;
except
on E:Exception do
begin
MessageDlg('connection error!', mtError, [mbOK], 0);
btnConnect.Enabled := true;
btnDisconnect.Enabled := false;
btnDownload.Enabled := false;
end;
end;
end;
procedure TCleint.btnDisconnectClick(Sender: TObject);
begin
try
if IdFTP.Connected then
begin
IdFTP.Disconnect;
listaDirectory.Clear;
btnConnect.Enabled := True;
btnDisconnect.Enabled := False;
btnDownload.Enabled := False;
end;
except
on E:Exception do
begin
MessageDlg('connection error!', mtError, [mbOK], 0);
btnConnect.Enabled := false;
btnDisconnect.Enabled := true;
btnDownload.Enabled := true;
end;
end;
end;
procedure TCleint.btnDownloadClick(Sender: TObject);
begin
end;
end.
你的問題到底是什麼? –