Good morning, I'm trying to send an image from JAVA-ANDROID to a server via ftp, this is the code I'm using within an asynchronous task.
try {
FTPClient ftpClient = new FTPClient();
ftpClient.connect(InetAddress.getByName("ftp.miweb.com.co"));
ftpClient.login("[email protected]", "miclave");
ftpClient.changeWorkingDirectory("/micarpeta");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedInputStream buffIn = null;
buffIn = new BufferedInputStream(new FileInputStream("/storage/8ABF-1303/Download (1)/soda_stereo_03.jpeg"));
ftpClient.enterLocalPassiveMode();
ftpClient.storeFile("foto.jpg", buffIn);
buffIn.close();
ftpClient.logout();
ftpClient.disconnect();
} catch (Exception s) {
Log.i("consola", "Ups...");
return "false";
}
The problem is in this line, when trying to load the image from the Uri
buffIn = new BufferedInputStream(new FileInputStream("/storage/8ABF-1303/Download (1)/soda_stereo_03.jpeg"));
I get the following error in the LOGCAT:
java.io.FileNotFoundException: /storage/8ABF-1303/Download (1)/soda_stereo_03.jpeg: open failed: EACCES (Permission denied)
In the end it says permission denied, these are my permissions of the manifest:
<uses-feature android:name="android.hardware.camera"
android:required="false">
</uses-feature>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
I already investigated a good time and I have not found much about it, I hope you can help me, thanks
This is the tutorial of which I was guided: link