file upload – Send arquivo (imagem) retrofit hair 2 (android)

Through api using or retrofit2, porem is facing some problems, and precise of a person ajuqúo to fazer segue to baixo or meu code, a postman image to com api.

Insert a description of images here.

criação do retrofit

Public class APIUrls {

// public static final String URL = "http://www.digitalboxnet.com/eoff/include/";

Public static end string URL = "http://192.168.30.24:4004";
// public static final String URL = "https://sportvar.herokuapp.com/";

Private static retrofit Retrofit = null;


public static
Retrofit retrofitObj (String URL) {
retrofit = null;
if (retrofit == null) {
retrofit = new Retrofit.Builder (). baseUrl (URL) .addConverterFactory (GsonConverterFactory.create ()). build ();
}
return of modification
}

}

Interface

Public interface APIServicio {

@Multipart
@POST ("/ user / send")
Call upload photo
@Part ("file") RequestBody file, @ Part MultipartBody.Part file1

);

}

hitting an image

    public void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult (requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == 1) {

// // region test
Uri selectImage = data.getData ();
Rope[] filePath = {MediaStore.Images.Media.DATA};
Cursor c = getContentResolver (). Query (selectImage, filePath, null, null, null);
c.moveToFirst ();
int columIndex = c.getColumnIndex (filePath[0]);
String pictirePath = c.getString (columIndex);
path = Uri.parse (c.getString (columIndex));
c.close ();

                                file = new File (pictirePath);

Toast.makeText (context, file.getAbsolutePath (), Toast.LENGTH_SHORT) .show ();

// // endregion

                                RequestBody requestFile =
RequestBody.create (MediaType.parse ("multipart / form-data"), file);

body =
MultipartBody.Part.createFormData ("picture", file.getName (), requestFile);


String descriptionString = "your description";

description =
RequestBody.create (
MediaType.parse ("multipart / form-data"), descriptionString);


// endregion


}


}

called minha

                                                Call call = service.uploadfoto (description, body);

call.enqueue (new Callback() {
@Cancel
Public void in response (call call, response answer) {

if (response.body (). erro) {

Toast.makeText (MainActivity.this, "Erro", Toast.LENGTH_SHORT) .show ();


} else {

Toast.makeText (MainActivity.this, "Sent", Toast.LENGTH_SHORT) .show ();
}


}

@Cancel
public emptiness in failure (called call, tirable t) {


Toast.makeText (MainActivity.this, t.getMessage (), Toast.LENGTH_SHORT) .show ();
Log.e ("console", t.getMessage ());

}
});

erro I'm getting

E / console: end of unexpected flow on the connection {192.168.30.24:4004, proxy = DIRECT hostAddress = / 192.168.30.24: 4004 cipherSuite = none protocol = http / 1.1}

It is alguem puder ajuda já graciasço