L
lctuchen
Unregistered / Unconfirmed
GUEST, unregistred user!
我上传文件没问题,怎么上传文件夹总出错,说找不到文件路径。
哪位帮帮忙,多谢!!
procedure tfrmmain.UploadDir(idFTP : TIdFtp; LocalDir:string; RemoteDir: string);
var
s:tsearchrec;
i:integer;
begin
//判断服务器是否存在相应Local目录,如没有,新建之
//i:=findfirst(LocalDir,fadirectory,s);
IdFTP.TransferType := ftBinary;
//strPath:=LocalDir+'/'+extractfilename(s.Name);
IdFTP.Put(LocalDir+'/' ,'',false);
//IdFTp.ChangeDir(RemoteDir);
i:=findfirst(LocalDir+'/*.*',faAnyFile,s);
while i=0 do
begin
if s.name[1]<>'.' then
begin
if (s.attr and fadirectory)=fadirectory then
begin
uploaddir(idftp, LocalDir+'/'+s.name,idftp.RetrieveCurrentDir +'/'+s.name);
end
else
//是文件,直接上传
//IdFTP.Put(LocalDir+'/'+s.name);
Idftp.Put(LocalDir+'/'+s.name,idftp.RetrieveCurrentDir +'/'+s.name,false);
end;
i:=findnext(s);
end;
end;
哪位帮帮忙,多谢!!
procedure tfrmmain.UploadDir(idFTP : TIdFtp; LocalDir:string; RemoteDir: string);
var
s:tsearchrec;
i:integer;
begin
//判断服务器是否存在相应Local目录,如没有,新建之
//i:=findfirst(LocalDir,fadirectory,s);
IdFTP.TransferType := ftBinary;
//strPath:=LocalDir+'/'+extractfilename(s.Name);
IdFTP.Put(LocalDir+'/' ,'',false);
//IdFTp.ChangeDir(RemoteDir);
i:=findfirst(LocalDir+'/*.*',faAnyFile,s);
while i=0 do
begin
if s.name[1]<>'.' then
begin
if (s.attr and fadirectory)=fadirectory then
begin
uploaddir(idftp, LocalDir+'/'+s.name,idftp.RetrieveCurrentDir +'/'+s.name);
end
else
//是文件,直接上传
//IdFTP.Put(LocalDir+'/'+s.name);
Idftp.Put(LocalDir+'/'+s.name,idftp.RetrieveCurrentDir +'/'+s.name,false);
end;
i:=findnext(s);
end;
end;