I want to upload a text file on a FTP using apache commons=net 1.4.1.
My code:
public static void UploadTextFile(String host, String name) {
try {
FTPClient ftp = new FTPClient();
ftp.connect(host);
int reply;
ftp.login("u757471605", "cacat1");
String str = "GG FRT O IESIT";
InputStream input = new ByteArrayInputStream(str.getBytes());
String loc = host + "/public_html/" + name;
ftp.storeFile(loc, input);
ftp.disconnect();
System.out.println(loc);
// this.ftp.storeFile(hostDir + fileName, input);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This doesn't catch any errors but the file is not uploaded.
Where I'm wrong?
I found that
System.out.println(ftp.storeFile(loc, input))
If i put that code i get the text false in output log, and true at ftp.login. What can be the prob