Uploading an Image using AWS SDK for PHP 2


This is driving me crazy — I have been working on this problem for several days with little success. I’ve finally hit a brick wall and need help. A lot of the articles and forums that I have searched are not for AWSSDK for PHP 2.

We have been using Amazon’s S3 to load images through iOS for the past couple of years.

Now, I need to implement the upload in a browser.

I have downloaded and successfully installed AWSSDK for PHP 2 on our Ubuntu server. I can get connected to our AWS S3 account and display the contents of the buckets. But I am unable to put an image in a bucket.

The Exception from AWS is:
Aws\S3\Exception\NotImplementedException: AWS Error Code: NotImplemented, Status Code: 501, AWS Request ID: CEDC4BBAA83CF70C, AWS Error Type: server, AWS Error Message: A header you provided implies functionality that is not implemented.

Here is the URL that I got the below example code from, under the heading called Uploading a File to Amazon S3: https://github.com/aws/aws-sdk-php#quick-start

And I updated my code based on this: AWS PHP SDK Version 2 S3 putObject Error

But it still doesn’t work.

Here is my code:

Can someone please provide me with an example so I can upload the JPG image into our bucket on S3 using AWSSDK for PHP 2?

From ppostma1’s reply, I have modified my code as follows, and it now works:


First, you are missing a s3 ‘filename’ aka key:

Next, I have had far fewer complications with:

with being able to find the class files. Every time I try to include ./common/aws or ./s3/s3client, it start giving me “cannot find Aws\S3\Aws\S3Client” which leaves me at wt???

Leave a Reply