IndyFTPServer问题 最近用Indy的FTPServer编写FTP服务器,发现不能正常LIST文件列表,客户端用CuteFtp,而用一使用API写的客户端正常,上传文件的话,文件存放的地址也正确。????????不懂,难道是OnListDirectory的问题????各位老大给点建议,或给点源代码参考一下。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TdmVFTPServer.AddFTPFileList(ADirectoryListing: TIdFTPListItems; AFolder: string);var w32fd: TWin32FindData; h: THandle; lTime: TFileTime; sTime: TSystemTime;begin if not DirectoryExists(AFolder) then Exit; if AFolder[Length(AFolder)] = '\' then AFolder := AFolder + '*.*' else AFolder := AFolder + '\*.*'; h := Windows.FindFirstFile(PChar(AFolder), w32fd); while h <> INVALID_HANDLE_VALUE do begin with ADirectoryListing.Add, w32fd do begin FileName := ExtractFileName(cFileName); if (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then ItemType := ditFile else ItemType := ditDirectory; Size := nFileSizeHigh * MAXDWORD + nFileSizeLow; FileTimeToLocalFileTime(ftCreationTime, lTime); if FileTimeToSystemTime(lTime, sTime) then ModifiedDate := EncodeDate(sTime.wYear, sTime.wMonth, sTime.wDay) + EncodeTime(sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliSeconds) else ModifiedDate := Now; GroupName := vft_FTP; OwnerName := vft_FTP; UserPermissions := 'rw-'; GroupPermissions := 'rw-'; OwnerPermissions := 'rw-'; end; if not Windows.FindNextFile(h, w32fd) then Break; end; Windows.FindClose(h);end;在List事件处理:AddFTPFileList(ADirectoryListing, ConvertFTPPathToLocalPath(APath, false));上面的只是方法,自己分析一下吧http://lysoft.7u7.net TO: ly_liuyang(Liu Yang)能否给一下ConvertFTPPathToLocalPath(APath, false)的代码?设置Homedir和CurrentDir按FTP目录结构还是按WINDOWS目录结构方式。先谢了!!!! 为何调试时提示ADOQuery没有设置为读写的权限,急,请问这是什么? 有关ADO与BDE的问题.请大家帮忙! 谢谢 奇怪的错误,请大虾指点 如何实现pointer类型的数据写到数组中? 如何设置系统时间? 请问在dll中如何获得调用自身的应用程序的句柄呢? TRegistry的GetKeyNames出错,请问是什么原因? MEMO怎么删除我选择的行呢? 关于数据库插入的菜问题!!! About Report! 想到了一个好主意:申请了一个163的大邮箱(1500M),供大家一起用来共享。 简单的RzProgressBar1问题,在线等!!
AFolder: string);
var
w32fd: TWin32FindData;
h: THandle;
lTime: TFileTime;
sTime: TSystemTime;
begin
if not DirectoryExists(AFolder) then Exit;
if AFolder[Length(AFolder)] = '\'
then AFolder := AFolder + '*.*'
else AFolder := AFolder + '\*.*';
h := Windows.FindFirstFile(PChar(AFolder), w32fd);
while h <> INVALID_HANDLE_VALUE do
begin
with ADirectoryListing.Add, w32fd do
begin
FileName := ExtractFileName(cFileName);
if (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0
then ItemType := ditFile
else ItemType := ditDirectory;
Size := nFileSizeHigh * MAXDWORD + nFileSizeLow;
FileTimeToLocalFileTime(ftCreationTime, lTime);
if FileTimeToSystemTime(lTime, sTime)
then ModifiedDate := EncodeDate(sTime.wYear, sTime.wMonth, sTime.wDay) + EncodeTime(sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliSeconds)
else ModifiedDate := Now;
GroupName := vft_FTP;
OwnerName := vft_FTP;
UserPermissions := 'rw-';
GroupPermissions := 'rw-';
OwnerPermissions := 'rw-';
end;
if not Windows.FindNextFile(h, w32fd) then Break;
end;
Windows.FindClose(h);
end;在List事件处理:AddFTPFileList(ADirectoryListing, ConvertFTPPathToLocalPath(APath, false));上面的只是方法,自己分析一下吧http://lysoft.7u7.net
能否给一下ConvertFTPPathToLocalPath(APath, false)的代码?设置Homedir和CurrentDir按FTP目录结构还是按WINDOWS目录结构方式。先谢了!!!!