Skip to content

Instantly share code, notes, and snippets.

@NoNews
Created December 16, 2018 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NoNews/d1e9579c658fe4f61a3420c0c571d4a7 to your computer and use it in GitHub Desktop.
Save NoNews/d1e9579c658fe4f61a3420c0c571d4a7 to your computer and use it in GitHub Desktop.
File file = new File(selectedImage.getPath());
RequestBody body = RequestBody.create(MediaType.parse("image/*"), file);
restApi.imageEndpoint.upload(user.getToken(), body)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(this::successGetImageDTO, this::errorGetImageDto);
@Multipart
@POST("user/avatarUpload")
Observable<StatusResponse<UserDTO>> uploadAvatar(@Part("file\"; filename=\"cover.png\" ") RequestBody file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment