Ici, j'utilise @Fields
données avec @FormUrlEncoded
Mais je dois utiliser les deux dans la même API @Part("user_image") RequestBody file
avec @Multipart
. Comment est-ce possible? Merci d'avance.comment envoyer un fichier image avec Retrofit (@Fields)
@FormUrlEncoded
@POST("/datingapp/index.php/Webservice")
Call<Result> signupUser(@Field("user_name") String name,
@Field("age") String age,
@Field("work") String work,
@Field("home_town") String home_town,
@Field("gender") String gender,
@Field("interest") String interest,
@Field("study") String study,
@Field("email") String email,
@Field("password") String password,
@Field("device_id") String device_id,
@Field("device_type") String device_type,
@Part("user_image") RequestBody file,
@Field("signup") String signup);
Vous pouvez envoyer une image sous la forme de chaîne base64. Je n'ai jamais utilisé Retrofit, mais jetez un oeil [ICI] (http://stackoverflow.com/questions/22787585/android-retrofit-base64body) et [ICI] (http://stackoverflow.com/questions/32009612/retrofit -send-base64-encoded-string-in-parameters) –