S3 putObject callback not returning expected objects

Question:

I want to get the link of the file (or file name is also fine) after I uploaded my image to S3. I upload using below code and it worked.

But in the callback data it has only 1 property, the etag. In the doc it clearly stated it has other object, so how do I get the path of the uploaded file?

Answer:

The docs don’t imply that the object key will be available in the data callback parameter.

You can work out the S3 URI of the created object based on the bucket’s name and the params.Key property on the request data.

Here’s an example of how to do that from within the putObject callback

Leave a Reply