还真找到当年的代码了,摘一段给你看看 try CuteFtp := TNMFTP.Create(nil); succ := false; Trans_Type := cmdDownload; with CuteFtp do begin host := FtpHost; Port := FtpPort; UserId := FtpUser; PassWord := FtpPwd; TimeOut := 600000; try connect; if ftpmode='MODE_ASCII' then Mode(MODE_ASCII) else if ftpmode='MODE_BYTE' THEN Mode(MODE_BYTE) else if ftpmode='MODE_IMAGE' THEN Mode(MODE_IMAGE); except
Disconnect; ShowMessage(' 连接失败!); Result := false; exit; end; ChangeDir(FtpRpath); try download(ftprpath + downfile, downfilepath + downfile); except on e: exception do begin disconnect; exit; end; end; Disconnect; free; end;
try
CuteFtp := TNMFTP.Create(nil);
succ := false;
Trans_Type := cmdDownload; with CuteFtp do
begin
host := FtpHost;
Port := FtpPort;
UserId := FtpUser;
PassWord := FtpPwd;
TimeOut := 600000; try
connect;
if ftpmode='MODE_ASCII' then
Mode(MODE_ASCII)
else if ftpmode='MODE_BYTE' THEN
Mode(MODE_BYTE)
else if ftpmode='MODE_IMAGE' THEN
Mode(MODE_IMAGE);
except
Disconnect;
ShowMessage(' 连接失败!);
Result := false;
exit;
end; ChangeDir(FtpRpath);
try
download(ftprpath + downfile, downfilepath + downfile);
except
on e: exception do
begin
disconnect;
exit;
end;
end;
Disconnect;
free;
end;