Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EndpointInterface service = ServiceAuthGenerator.createService(EndpointInterface.class);
- MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
- RequestBody body = RequestBody.create(mediaType,file);
- //RequestBody fileBody = RequestBody.create(MediaType.parse("image/jpg"), file);
- Call<JSONObject> call = service.uploadPhoto(body);
- call.enqueue(new Callback<JSONObject>() {
- @Override
- public void onResponse(Response<JSONObject> response, Retrofit retrofit) {
- Log.v("Upload->", response.message().toString());
- }
- @Override
- public void onFailure(Throwable t) {
- Log.e("Upload", t.getMessage());
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement