I am trying to upload a image file to ftp server. the connect and login are successful but the uplaod always returns 550 access is denied.
this is my code below
FTPClient client = new FTPClient();
FileInputStream fis = null;
int reply = 0;
try {
fis = new FileInputStream(new File(lastImageName));
Log.i("file_path", lastImageName);
client.connect("xxx.xxx.xxx.xxx", 21);
reply = client.getReplyCode();
Log.i("ftp_connect reply", reply + " "+client.getReplyString());
boolean loginStatus = client.login("test", "test");
Log.i("login_success??", loginStatus + " "+ client.getReplyString());
client.pasv();
// client.enterRemotePassiveMode();
client.enterLocalPassiveMode();
client.changeWorkingDirectory("abc");
client.setFileType(FTP.BINARY_FILE_TYPE);
boolean uploadstatus = client.storeFile("/abc", fis);
// int uploadstatus2 = client.stor(lastImageName);
String stringReply = client.getReplyString();
Log.i("upload_success??", uploadstatus + " " + stringReply);
client.logout();
client.disconnect();
but wen i try to upload a file using fireFTP it works. I dont get that access is denied error. Any suggestions?
Remove this:
boolean uploadstatus = client.storeFile("/abc", fis);
with this:
boolean uploadstatus = client.storeFile("abc", fis);