我的api
http://192.168.0.2/littlezebra/scripts/webservice.php?Case=updateProfile&user_id=1&profile_picture=happychild.png
如何在@Query中发送此
答案 0 :(得分:0)
改造界面:
@Multipart
@POST("upload/chatImage")
fun uploadChatImage(@Part file: MultipartBody.Part, @Query("something") something: String): Single<UploadedImage>
用法:
fun uploadChatImage(uri: String?): Single<UploadedImage> {
val picture = File(uri)
val requestFile = RequestBody.create(MediaType.parse("image/*"), picture)
val body = MultipartBody.Part.createFormData("photo", picture.name, requestFile)
return apiService.uploadChatImage(body, "something")
}
我使用RxJava适配器进行改造和kotlin语言。没有RxJava和kotlin,你可以这样做。