I am getting the presigned URL from Lambda, but not sure why when I make a PUT request to that generated URL, my image is not being uploaded to S3.
I've followed these two answers exactly, but it's still not working for me
https://stackoverflow.com/a/46177449/11110509
https://stackoverflow.com/a/46579224/11110509
Could someone point out what I'm doing wrong?
public interface IUploadImages{
@PUT
Call<String> listRepos(@Url String url, @Body RequestBody image);
}
And my call to upload the image:
//Already checked to make sure mImageUri is not null
File file = new File(StringUtils.getPath(this, mImageUri));
RequestBody requestFile = RequestBody.create(MediaType.parse("image/jpeg"), file);
RetrofitInterfaces.IUploadImages service = RetrofitClientInstance.getRetrofitInstance()
.create(RetrofitInterfaces.IUploadImages.class);
//Also checked to make sure mGeneraredUrl is also not null
Call<String> call = service.listRepos(mGeneratedUrl, requestFile);
call.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if(response.isSuccessful()){
Log.d(TAG, "onResponse: Success?");
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
Log.d(TAG, "onFailure: Failed: " + t);
}
});
I've made the bucket public. The call is not failing, but in onResponse I'm getting a response code of 403.