I am currently uploading files to my Synology NAS.
If there are no files in the directory where you want to save the file, the file will be saved as I intended.
// ...
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
// ...
ftpClient.storeFile(path, inputStream)
public boolean storeFile(String remote, InputStream local) throws IOException {
return this.storeFile(FTPCmd.STOR, remote, local);
}
private boolean storeFile(FTPCmd command, String remote, InputStream local) throws IOException {
return this._storeFile(command.getCommand(), remote, local);
}
protected boolean _storeFile(String command, String remote, InputStream local) throws IOException {
Socket socket = this._openDataConnection_(command, remote);
// ...
}
protected Socket _openDataConnection_(String command, String arg) throws IOException {
if (this.dataConnectionMode != 0 && this.dataConnectionMode != 2) {
return null;
} else {
// ...
}
However, if there is at least one file, the this.dataConnectionMode value is set to 2 in the code above and null is returned.
What is this.dataConnectionMode and how can I solve it?