3

When I tried to convert the file selected by the user to request body, I got the error FileNotFound, open failed: EACCES (Permission denied) on Android 12. I was trying to upload a user-selected pdf using Retrofit Multipart Upload.

For calling intent I have used ACTION_OPEN_DOCUMENT

file.asRequestBody("multipart/form-data".toMediaTypeOrNull()

Do I need to use MANAGE_EXTERNAL_STORAGE permission?

Bincy Baby
  • 3,941
  • 5
  • 36
  • 62
  • 4
    `ACTION_OPEN_DOCUMENT` gives you a `Uri`. It may or may not represent a file on the filesystem, let alone one that you can access. Use the `Uri` itself, with an `InputStreamRequestBody`: https://stackoverflow.com/questions/56308559/create-a-file-from-a-photo-uri-on-android – CommonsWare Dec 07 '21 at 19:33
  • your problem solved? – sasikumar Sep 19 '22 at 12:43

0 Answers0