Link to home
Start Free TrialLog in
Avatar of amielDorel
amielDorel

asked on

ftp server using indy

I was looking for a sample code using the Indy ftp server, unfortunately no one could find one,   next,  I have tried to use the ftpserver control
and activate it.  (at run time) ;  next I try to call the ftp server (using indy ftp client example)  unfortunately I getting client error,  this is why I needed a ftpserver example to begin with.  the ftpsever looks like a simple and easy to use object (5 event; 8 fields) yet it doesn't work, I get no change of status when I activate the ftpserver, and errors when I try to connect to it.

with all respect to Indy, maybe this control was never tested.


Thanks
ASKER CERTIFIED SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amielDorel
amielDorel

ASKER

Thanks I was,  do you know how to set diffrent users and password using the TIdFTPServer,  can I change the port number on the server and client, what the data port for ?
the TIdFTPServer has various methods of accepting users, there are properties like:

AnonymousAccounts

- here you can put a list of all the users that you want to be able to login anonymous (without need for a password), is provided as a TStringList so you could load this list from a file, a database, etc... or fill it in at design time

- the "password" required for those users will only be the email (it really can be anything in the X@Y.Z form)

- Along with that property there's AllowAnonymousAccounts, set it to True to allow anonymous users

- There's also AnonymousPassStrictCheck, which Indicates that passwords for anonymous accounts must contain a valid email address.

the other way to login would be using the event OnUserLogin:

procedure TForm1.IdFTPServer1UserLogin(ASender: TIdFTPServerThread;
  const AUsername, APassword: String; var AAuthenticated: Boolean);
begin
  AAuthenticated:=True
end;

if you wanted to just allow everyone (not recommended) to your site you could use the code above, but here you are provided with the UserName and Password and you can use whatever you want to validate those (a database, a text file, etc)

Yes, you can change the port numbers, most FTP clients should allow you to change the port you want to connect, so that shouldn't be a problem