Skip to content

Cant use the upload of the s3 service #35

@ITOoscarestupinan

Description

@ITOoscarestupinan

Hello everyone,

I'm having an issue, i'm trying to upload a file to an amazon s3 server.

$pdf=$rootdir . '/../web/uploads/pdf/'.$reference.'.pdf';
$s3 = $this->container->get('aws_s3');
$bucket = 'my-bucket';
$headers = $s3->get_object_headers($bucket, $pdf);
var_dump($headers->header['content-type']);
$response = $s3->update_object($bucket, $pdf, array(
'acl' => AmazonS3::ACL_PUBLIC,
'headers' => array(
'Content-Encoding' => 'UTF-8'
),
'meta' => array(
'Cache-Control' => 'Public',
'Max-Age' => '604800',
),
));
var_dump($response->isOK());

But always send me this error:

Warning: Cannot unset offset in a non-array variable in /root/dir/to/my/vendor/amazonwebservices/aws-sdk-for-php/services/s3.class.php line 1881

What i'm doing wrong? i take the example from here : http://docs.aws.amazon.com/AWSSDKforPHP/latest/#m=AmazonS3/update_object

Hope someone could help me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions