Alamofire image upload with PUT


I’m currently trying to upload an Image to amazon with pre-signed url.

The way it works is, I make a GET request to get the pre-signed URL and than a PUT request to upload the image by using the url returned from the GET request.

The two rules are: the Content-Type needs to be image\jpeg and the http methods must be PUT.

So, currently my upload code returns 200 but amazon rejects the data.

Here is my code:

The actual url returned for the upload is:

I suspect that when I print the http headers the Content-Type always shows multipart/form-data and not the image/jpeg that I need, but currently I’m lost on what to do to solve this.


I actually recently had the same requirements (except I needed PNG instead of JPG).

Here is how you go about it.

Leave a Reply