Hi!
I've decided to open a new thread for discussing the problem with uploading a file to a SUB-FOLDER at the FTP Server. So, I'm using Apache Commons library and I can upload my file to the Home Directory of the FTP server. However, if I want to upload it to some sub-folder, then nothing happens (no results, no errors). Please, give me some advices. Thanks!
import org.apache.commons.net.ftp.*;
...
private saveRemote() {
FTPClient client = new FTPClient();
FileInputStream fis = null;
try {
client.connect(url);
client.login("admin","pass");
client.setFileType(FTP.BINARY_FILE_TYPE);
//
// Create an InputStream of the file to be uploaded
//
String filename = text4.getText();
fis = new FileInputStream(pathToFile);
//
// Store file to server
//
client.storeFile(filename, fis);
client.logout();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null) {
fis.close();
}
client.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}