I have a content URI in the form of "content://media/external/images/media/175". I am trying to find the absolute path of the image in question in order to send the file in a request. Is there any way to accomplish this?
I am trying to find the absolute path of the image
A Uri
is not a file. You cannot convert arbitrary Uri
values to some filesystem path that you can access. Those Uri
values might point to:
ContentProvider
ContentProvider
BLOB
in a databasein order to send the file in a request
Use a ContentResolver
and openInputStream()
to get an InputStream
to use in your request. If whatever API you are using does not support an InputStream
, either:
Use that InputStream
to make a local file copy on your own internal storage, then use that file
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments