idFTPserver
Mam mensi problem vse funguje az na jedno v Totalcmd , FF se nezobrazi zadna data ale pri zadani cilove adresi vse probehne OK, problem spociva v tom ze IE zobrazi vsechna data korektne nastaveni emulace je ftpsdos , pri ftpsvax nic nezobrazi a ftpslinux zobrazi data i slozky ale slozky nelze otevrit kde muze byt chyba ??
Prvni cast :
procedure TForm1.IdFTPServer1AfterUserLogin(ASender: TIdFTPServerThread);
begin
ASender.HomeDir := '\';
ASender.CurrentDir := '\';
appdir := ExtractFilePath('f:\AppServ\generals\');
end;
procedure TForm1.IdFTPServer1UserLogin(ASender: TIdFTPServerThread;
const AUsername, APassword: String; var AAuthenticated: Boolean);
begin
AAuthenticated := ((AUsername = 'certcv') and (APassword = 'opicak'));
if AAuthenticated = true then
begin
listbox1.Items.Add(AUsername);
end;
end;
procedure TForm1.IdFTPServer1StoreFile(ASender: TIdFTPServerThread;
const AFileName: String; AAppend: Boolean; var VStream: TStream);
begin
if not Aappend then
begin
VStream := TFileStream.Create(appdir + AFilename,fmCreate);
end;
if Aappend then
begin
VStream := TFileStream.Create(appdir + AFilename,fmOpenReadWrite);
end;
end;
procedure TForm1.IdFTPServer1RetrieveFile(ASender: TIdFTPServerThread;
const AFileName: String; var VStream: TStream);
begin
VStream := TFileStream.Create(AppDir + AFilename,fmOpenRead);
Application.ProcessMessages;
end;
procedure TForm1.IdFTPServer1ChangeDirectory(ASender: TIdFTPServerThread;
var VDirectory: String);
begin
Asender.CurrentDir := VDirectory;
change_dir := VDirectory;
VDirectory:='';
end;
procedure TForm1.IdFTPServer1ListDirectory(ASender: TIdFTPServerThread;
const APath: String; ADirectoryListing: TIdFTPListItems);
var
LFTPItem :TIdFTPListItem;
SR : TSearchRec;
SRI : Integer;
begin
SRI := FindFirst(AppDir + change_dir + '*.*', faAnyFile - faHidden - faSysFile, SR);
While SRI = 0 do
begin
LFTPItem := ADirectoryListing.Add;
LFTPItem.FileName := SR.Name;
LFTPItem.Size := SR.Size;
LFTPItem.ModifiedDate := FileDateToDateTime(SR.Time);
Application.ProcessMessages;
if SR.Attr = faDirectory then
LFTPItem.ItemType := ditDirectory
else
LFTPItem.ItemType := ditFile;
SRI := FindNext(SR);
end;
FindClose(SR);
SetCurrentDir(AppDir + '..');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
IdFTPServer1.DefaultPort:=spinedit1.Value;
IdFTPServer1.DefaultDataPort:=spinedit1.Value-1;
IdFTPServer1.Active:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
IdFTPServer1.Active:=false;
end;
procedure TForm1.IdFTPServer1Connect(AThread: TIdPeerThread);
begin
AThread.Connection.WriteLn('Vitej cerve zde muzes sosat');
end;
procedure TForm1.IdFTPServer1Disconnect(AThread: TIdPeerThread);
begin
listbox1.Items.Add(AThread.TerminatingException+'odpojen');
end;