I am trying to remove MANAGE_EXTERNAL_STORAGE, but after removing this permission I am not able to upload Multipart from the given path.
I am using this line of code to pick up the pdf file,
`Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/pdf");
resultLauncher.launch(intent);`
and I am getting the path like
/storage/emulated/0/Download/offer.pdf
After getting this path i am converting it into Multipart by using following code and uploading it to the server,
`File file = new File(path);
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(file, MediaType.parse("application/pdf")));`
and while uploading this on server i am getting an error which is:
java.io.FileNotFoundException: /storage/emulated/0/Documents/mSchooling/offer.pdf: open failed: EACCES (Permission denied).
One thing is that i already given read_external_storage and write_external_storage.
Please help me to resolve this problem.
I tried this code to pick up the file,
ntent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("application/pdf"); resultLauncher.launch(intent);
and trying to convert it into Multipart by using following code,
File file = new File(path); MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(file, MediaType.parse("application/pdf")));