I receive the image by an implicit intent from the gallery and while I install it in ImageView (bitmap). You need to send JSON with fields to the server, one of which is a link to the image. I use Retrofit2. I read something about a separate image download. There are thoughts on this. Send an image to the server (the user should play ProgressBar), get the path to the location on the server in response, and with this result send the final JSON Something is already returned to the server.
"results": [{ "id": 1, "title": "YOUR TITLE 1", "type": "YOUR TYPE 1", "picture": "http://myhost.ru/media/%D00%A3.jpg" }] val file = File(path.path) val requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file) val body = MultipartBody.Part.createFormData("picture", file.name, requestFile) @Multipart @POST("endpoint/") fun uploadPicture(@Part picture: MultipartBody.Part): Single<Any?>