Last active
November 4, 2019 13:49
-
-
Save AndSky90/c41313218c4798084a8ba0a06a81edaf to your computer and use it in GitHub Desktop.
Multipart jpg file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val b = BitmapFactory.decodeFile(filePath) | |
val stream = ByteArrayOutputStream() | |
b.compress(Bitmap.CompressFormat.JPEG, 100, stream) | |
val ba = stream.toByteArray() | |
photoPart = RequestBody.create(MediaType.parse("image/jpeg"), ba) | |
body = MultipartBody.Part.createFormData("Photo", "Photo.jpg", photoPart!!) | |
val part = RequestBody.create(MediaType.parse("text/plain"), text) | |
@Multipart | |
@PUT("$CURRENT_API/Endpoint/") | |
fun putProfile( | |
@Part("Text") name: RequestBody, | |
@Part image: MultipartBody.Part?, | |
): Observable<ResponseData<String>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment