user3729576
user3729576

Reputation: 247

S3 set mime type on upload

I've looked at a number of questions on SO, and tried the solution below. Unfortunately it's not working.

I'm trying to upload images to S3 using putObject and the AWS PHP SDK, along with a laravel implementation of the class and the intervention image class.

So I have:

$s3->putObject(array(
                'Bucket' => 'xxxx', 
                'Key' => 'xxxx',
                'Body' => $img->encode(null, $output['quality']),
                'ACL' => 'public-read',
                array('params' => array('ContentType' => $img->mime()))
            ));

The problem I'm having is that content type is always set to:

binary/octet-stream

How can I set to to the mime type of my uploaded image?

Upvotes: 5

Views: 2797

Answers (1)

Eswara Reddy
Eswara Reddy

Reputation: 1647

Replace $img->mime() with $img->getMimeType()

Upvotes: 3

Related Questions