ftp in java, with jakarta commons net library file upload 1.4.1
807598Aug 7 2006 — edited Jun 6 2007Hello:
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