android-image-picker icon indicating copy to clipboard operation
android-image-picker copied to clipboard

Send image using retrofit

Open vj68 opened this issue 5 years ago • 2 comments

How do we send the returned Image object from getFirstImageOrNull using retrofit?

Can we get the path (or) File object of this image?

vj68 avatar Jan 07 '20 18:01 vj68

Use image.getPath() to get the image path. You can find a full tutorial here https://androidclarified.com/android-image-upload-example/

PiwanSama avatar Jan 08 '20 11:01 PiwanSama

Thank you @PiwanSama . I used

File file = new File(image.getPath).
RequestBody fileToUpload = RequestBody.create(MediaType.parse("*/*"),file);

vj68 avatar Jan 09 '20 20:01 vj68

If anyone trying to figure out get the image from a URI, please refer to this https://github.com/esafirm/android-image-picker/issues/307#issuecomment-1320995444

esafirm avatar Nov 20 '22 00:11 esafirm