Issue
i have a class in android that connect with the ftp, and store an image, that works perfect the problem is when i am trying to move the image to another directory( i use a php page to moderate that image) it doesnt have permission to handle it, i want to put the permission to 0777 but only the "java code" can do it but i dont know how,
I am using FTPClient library
this is my code
File imageFile = new File(url[0]);
FTPClient ftpClient = new FTPClient(); ftpClient.connect(InetAddress.getByName("myserver"));
ftpClient.login("login", "pass");
ftpClient.changeWorkingDirectory("directory");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedInputStream buffIn=null;
buffIn=new BufferedInputStream(new FileInputStream(imageFile));
ftpClient.enterLocalPassiveMode();
ftpClient.storeFile(url[1]+".jpg", buffIn);
buffIn.close();
ftpClient.logout();
ftpClient.disconnect();
Solution
I made it by command
ftpClient.storeFile(url[1]+".jpg", buffIn);
boolean a = ftpClient.sendSiteCommand("chmod " + "777 " + "/absolutepath/"+url[1]+".jpg");
Answered By - D4rWiNS Answer Checked By - Mary Flores (WPSolving Volunteer)