Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. EndpointInterface service = ServiceAuthGenerator.createService(EndpointInterface.class);
  2. MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
  3. RequestBody body = RequestBody.create(mediaType,file);
  4. //RequestBody fileBody = RequestBody.create(MediaType.parse("image/jpg"), file);
  5. Call<JSONObject> call = service.uploadPhoto(body);
  6. call.enqueue(new Callback<JSONObject>() {
  7.  
  8. @Override
  9. public void onResponse(Response<JSONObject> response, Retrofit retrofit) {
  10. Log.v("Upload->", response.message().toString());
  11.  
  12. }
  13.  
  14. @Override
  15. public void onFailure(Throwable t) {
  16. Log.e("Upload", t.getMessage());
  17. }
  18. });
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement