最近用Indy的FTPServer编写FTP服务器,发现不能正常LIST文件列表,客户端用CuteFtp,而用一使用API写的客户端正常,上传文件的话,文件存放的地址也正确。????????不懂,难道是OnListDirectory的问题????各位老大给点建议,或给点源代码参考一下。
解决方案 »
- 求sql写法
- 台湾正在搞国旗设计
- 初步学习DLL,编了一个小的DLL,可是,总编译不了啊,高手帮忙看看。
- 如何获跟FLASH传递参数
- ACCESS与SQLSERVER有何不同?
- 怎么样获得一棵树的全部最终子节点(即叶子),但需要记录其上级节点过程?
- 100分太少了,请教一个SQL语句的问题。
- 应用程序和数据库链界的问题?
- 用queuy怎么取到记录的字段总数?在线等待回复~
- 怎样修改由多个表join来的Access表
- 调用接口的问题,我的com实现了两个接口Iservermodule﹐MyInterface﹐我通过socketconnection1.AppServer调用函数﹐只能调用Iservermodule
- 如何在Delphi下利用拖拽实现文件(文件夹)的移动和复制!!!望高手指点,多谢!!!
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目录结构方式。先谢了!!!!
WithLastBackslash: boolean; const CurrentDir:string = ''): string;
var p: string;
begin
Result := '';
p := APath;
// p is "/aa/bb/cc"
if p = '' then Exit;
// make sure p is "aa/bb/cc"
if Pos('/', p) = 1 then Delete(p, 1, 1);
p := StringReplace(p, '/', '\', [rfReplaceAll]);
if FTPServerFolder[Length(FTPServerFolder)] = '\'
then Result := FTPServerFolder + p
else Result := FTPServerFolder + '\' + p;
if WithLastBackslash then
begin
if Result[Length(Result)] <> '\' then Result := Result + '\';
end else if Result[Length(Result)] = '\' then Delete(Result, Length(Result), 1);
end;FTP目录结构需要转换为WINDOWS目录结构方式才能处理!http://lysoft.7u7.net