J
jmfyx
Unregistered / Unconfirmed
GUEST, unregistred user!
我用过Indy Client的IdFtp和IdHttp,效果不错,挺方便。以下为IdFtp源码,供参考。
LoginDialog('FTP服务器用户名和密码',user,password);
filename:=extractfilepath(application.exename)+'maindata';
curbackup(filename);
idftp1.host:='ftp.nease.net';
idftp1.Username:=user;
idftp1.password:=password;
idftp1.port:=21;
idftp1.Connect(true);
if idftp1.Connected then
begin
idftp1.Passive:=true;
idftp1.SendCmd('CWD cp');
idftp1.Put(filename,'maindata');
showmessage('成功上传数据');
end
else
showmessage('上传数据失败');
end
LoginDialog('FTP服务器用户名和密码',user,password);
filename:=extractfilepath(application.exename)+'maindata';
curbackup(filename);
idftp1.host:='ftp.nease.net';
idftp1.Username:=user;
idftp1.password:=password;
idftp1.port:=21;
idftp1.Connect(true);
if idftp1.Connected then
begin
idftp1.Passive:=true;
idftp1.SendCmd('CWD cp');
idftp1.Put(filename,'maindata');
showmessage('成功上传数据');
end
else
showmessage('上传数据失败');
end