给你一小段我自己写的IDFTP的程序吧:
my_ftp_form1.idftp1.Host:=ftp_host;
my_ftp_form1.idftp1.Username:=ftp_username;
my_ftp_form1.idftp1.Password:=ftp_password;
my_ftp_form1.idftp1.Disconnect;
my_ftp_form1.idftp1.Quit;
if uppercase(paramstr(4))='/P' then my_ftp_form1.idftp1.passive:=true else my_ftp_form1.idftp1.passive:=false;
if uppercase(paramstr(5))='/L' then my_ftp_form1.idftp1.ReadTimeout:=0 else my_ftp_form1.idftp1.ReadTimeout:=60000;
try
my_ftp_form1.idftp1.Connect;
application.ProcessMessages;
result:=true;
except
result:=false;
my_ftp_form1.suiEdit1.Text:='FTP '+ini_host_address+' Connection Error !';
write_connection_error_info;
my_ftp_form1.idftp1.Disconnect;
my_ftp_form1.idftp1.Quit;
closefile(my_ftp_log_file);
delay(6000);
exit_program;
end;