This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes FTP the files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "FTP the files" Watch "FTP the files" New topic

FTP the files

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
i need to FTP certain files to FTP server from my JSP file.

i have no idea how to proceed.

can any body help me how to proceed.
s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
This is the process that I have followed.

Files Involved:
1. Properties file: that has FTP site address, username and password and remote directory.
2. java class that reads the property file and opens connection to the FTP site and logs in. This should also have methods to get output stream through which you can write data.
3. Process FTP: Java class to get the information that needs to be FTPed. Get the connection by calling appropriate method on FTPConnection class, Get outputstream from FTPConnection and write data to it. Atlast close the connection.

1. JSP should have a button/link/any means to trigger FTP process. When user trigger this process, request will be sent to your servlet/controller.
2. Controller/servlet will make a call onto ProcessFTP class which would get the FTP connection, write data and close Connection as described above.

I have used Apache FTP.

Hope this helps.

Please let me know if you have a better approach.
It is sorta covered in the JavaRanch Style Guide.
subject: FTP the files