Answer the question
In order to leave comments, you need to log in
Why is the file not uploaded via FTP?
Hello, I have a block of code that should upload a file to an FTP server. The problem is that the code logs into FTP but doesn't send the file. What's the matter?
@Override
protected Void doInBackground(Void... voids) {
FTPClient fClient = new FTPClient();
FileInputStream fInput = null;
try {
fInput = new FileInputStream("/sdcard/calc/address.zip");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String fs = "Yes.zip";
try {
fClient.connect("10.0.2.2", 2323);
fClient.enterLocalPassiveMode();
fClient.login(log, password);
fClient.storeFile(fs, fInput);
fClient.logout();
fClient.disconnect();
} catch (IOException ex) {
System.err.println(ex);
}
return null;
}
(000013) 08.02.2021 14:58:10 - (not logged in) (127.0.0.1)> Connected on port 2323, sending welcome message...
(000013) 08.02.2021 14:58:10 - (not logged in) (127.0.0.1)> 220 Welcome to FTP server!
(000013) 08.02.2021 14:58:10 - (not logged in) (127.0.0.1)> USER admin
(000013) 08.02.2021 14:58:10 - (not logged in) (127.0.0.1)> 331 Password required for admin
(000013) 08.02.2021 14:58:10 - (not logged in) (127.0.0.1)> PASS *****
(000013) 08.02.2021 14:58:10 - admin (127.0.0.1)> 230 Logged on
(000013) 08.02.2021 14:58:10 - admin (127.0.0.1)> PASV
(000013) 08.02.2021 14:58:10 - admin (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,133,251)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question