2

I'm attempting to upload an image with AWS PHP SDK. For some odd reason some images aren't uploading?

$s3 = new Aws\S3\S3Client([
            'region'  => 'us-east-1',
            'version' => 'latest',
            'endpoint' => 'https://example.com',
            'use_path_style_endpoint' => true,
            'credentials' => [
                'key'    => $access_key,
                'secret' => $secret,
            ]
        ]);     


        try {

            $result = $s3->putObject([
                'Bucket' => $bucket,
                'Key'    => $file_name,
                'Body' => fopen($file_location, 'r'),
                'ContentType' => $imageType,
                'ACL'   => 'public-read'    
            ]);

        } catch(Aws\S3\Exception\S3Exception $e) {

            echo $e->getMessage();
        }

I can download an image from dummyimage.com and it will upload to a bucket successfully but when i attempt other images s3 returns a 500 internal server error.

How do i solve? There is nothing in the error logs.

user892134
  • 3,078
  • 16
  • 62
  • 128

0 Answers0