ここではデータに@FormUrlEncoded
を使用していますが、同じAPIで@Part("user_image") RequestBody file
と@Multipart
を両方とも使用する必要があります。どのように可能ですか?前もって感謝します。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);
をあなたはBase64文字列の形式で画像を送信することができます。私はRetrofitを使用したことはありませんが、こちら[こちら](http://stackoverflow.com/questions/22787585/android-retrofit-base64-body)と[こちら](http://stackoverflow.com/questions/32009612/retrofit -send-base64-encoded-string in-parameters) –