AWS S3 Rest API with Android Retrofit V2 library, uploaded image is damaged

后端 未结 6 1570
生来不讨喜
生来不讨喜 2020-12-03 08:57

I\'m trying upload a Image from my Android APP to Amazon AWS S3 and I need use AWS Restful API.

I\'m using Retrofit 2

6条回答
  •  隐瞒了意图╮
    2020-12-03 09:42

    RequestBody avatarBody = RequestBody.create(MediaType.parse("image"),file);
    MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), avatarBody);
    
    
    @Multipart
    @POST(url)
    Call uploadImageAmazon(
                @Part MultipartBody.Part filePart);
    

    I had same experience, and solved it by https://github.com/square/retrofit/issues/2424 this solution

提交回复
热议问题