Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Ftp server problem - D7 indy10.1.5

www.cryer.info
Managed Newsgroup Archive

Ftp server problem - D7 indy10.1.5

Subject:Ftp server problem - D7 indy10.1.5
Posted by:"Daniel" (..@gmail.com)
Date:18 Sep 2006 06:27:53

I'm trying to write a ftpserver application, and has hit a snag. The listdirectory procedure code that i have, crashes the application when i use the list command with Telnet. Here's the code that i have:

var
LFTPItem :TIdFTPListItem;
SR : TSearchRec;
SRI : Integer;
begin
  SRI := FindFirst(Homedir + APath + '\*.*', faAnyFile, SR);
  While SRI = 0 do
  begin
    LFTPItem := ADirectoryListing.Add;
    LFTPItem.FileName := SR.Name;
    LFTPItem.Size := SR.Size;
    LFTPItem.ModifiedDate := FileDateToDateTime(SR.Time);
    if SR.Attr = faDirectory then
     LFTPItem.ItemType   := ditDirectory
    else
     LFTPItem.ItemType   := ditFile;
    SRI := FindNext(SR);
  end;
  FindClose(SR);
  SetCurrentDir(Homedir + APath + '\..');
end;
Thanks

Replies:

www.cryer.info
Managed Newsgroup Archive