여기에이 질문을 게시하기 전에 인터페이스 메서드 위에 @Multipart
을 추가하려고 시도했습니다. 그리고 stackoverflow에서 검색하는 것이 여전히 내 문제와 유사하지 않습니다.@Part 매개 변수는 멀티 파트 인코딩에만 사용할 수 있습니다. (매개 변수 # 8)
이 경우 서버에 TypedFile
을 사용하여 이미지를 보내려고합니다. 이 같은 내 인터페이스 방법의 모습 : 우리가 @Part
및 @Body
볼 수있는 방법은
@Headers({"Content-type: application/json"})
@POST("/user/change")
void postChange(@Query("name") String name, @Query("email") String email, @Query("password") String password, @Query("phone") String phone, @Query("user_id") String userId, @Query("address[]") String[] listAddress, @Query("head[]") String[] head, @Part("photo_profile") TypedFile photoProfile, @Body TypedInput jsonObject, Callback<ReceiveDTO> callback);
편집
. 내가 방법 위에 @Multipart
를 추가 할 경우, 우리는 내가 을 사용하고 @Body parameters cannot be used with form or multi-part encoding. (parameter #9)
우리는 @query APPEND 매개 변수에서 Get
요청으로 사실 에 @query를 사용하여 1.9
여기의 예에 따라 제안 - 당신이 문제를 다음 다중 편집 질문을 사용하여 https://futurestud.io/blog/retrofit-2-how-to-upload-files-to-server facing –