Hi Rajeev

Rajeev kamal wrote:
Hello,
I want to implement FTP in one of my application. I need to port FTP in such way that the user can stop and start the FTP, add users, do dir listing and do other ftp change. I am trying to use the Embed code but I
a) That code is not working

What code are you looking at? There might be something which is out of date in our documentation.

b) when I change the code, I can start and stop the ftp, but I don't know how to add users, and do other FTP parameter change.
A sample code or your suggestion will be very much appreciated.

The add (and remove and make other changes) to users, you need to get the UserManager used with your server. Something like this should work:

        FtpServer server = new FtpServer();
        FtpServerContext context = server.getServerContext();
        UserManager userManager = context.getUserManager();

        BaseUser userToAdd = new BaseUser();
        userToAdd.setName("rajeev");
        userToAdd.setPassword("secret");

        userManager.save(userToAdd);

In this case it's using the default UserManager which will store users in a properties file. If you need additional examples, feel free to get back here!

I'm not sure of what other FTP parameters you want to change, could you please specify?

/niklas

Reply via email to