smplejohn
smplejohn

Reputation: 31

Showing blank image when uploading to AWS S3

I'm learning how to use Amazon for storing images and have gotten to the point I can upload a file with PHP. The problem is when I upload an image it shows as a blank image like it didn't upload. Here's what I've got:

$result = $s3->putObject(array(
      'Bucket'       => $bucket,
      'Key'          => $keyname,
      'Body'   => $filepath,
      'ContentType'  => 'image/jpeg',
      'ACL'          => 'public-read',
      'StorageClass' => 'STANDARD',
      'Metadata'     => array(    
          'param1' => 'value 1',
          'param2' => 'value 2'
      )
  ));

Here's the image it uploaded (which doesn't help much): https://motorcyclealbum.s3.amazonaws.com/test.jpg

Solved

So, 'Body' needed to be 'SourceFile' if uploading an image. I'm a dork.

Upvotes: 0

Views: 1893

Answers (1)

smplejohn
smplejohn

Reputation: 31

So, 'Body' needed to be 'SourceFile' if uploading an image. I'm a dork.

Upvotes: 1

Related Questions