Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ftp in java, with jakarta commons net library file upload 1.4.1

807598Aug 7 2006 — edited Jun 6 2007
Hello:

This is my code but it no runs..... i think that connect with the ftp but no transfer of files...

String server = "192.168.1.110";
String username = "joel";
String password = "123456";
String remote = "/privat/Joel/";
String local = "c:\\ftp.txt";

FTPClient ftp = new FTPClient();
//conectar al servidor and login
try
{
ftp.connect(server);
if(!ftp.login(username, password))
{
ftp.logout();
}
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply))
ftp.disconnect();
InputStream in = new FileInputStream(local);
ftp.setFileType(ftp.BINARY_FILE_TYPE);
boolean Store = ftp.storeFile("/privat/public",in);
in.close();
ftp.logout();
ftp.disconnect();

ANY IDEA?

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2007
Added on Aug 7 2006
41 comments
430 views