kraken-io/kraken-php

Error while pushing file to S3

Closed this issue · 3 comments

$original_upload_params = Array(
[file] => /tmp/phpH6Vxhr
[wait] => 1
[lossy] => 1
[s3_store] => Array(
[key] => XXXXXXXXXXXXX
[secret] => CCCCCCCCCCC+XXXXXXXXXX
[bucket] => b.fitn.in
[region] => ap-southeast-1
[headers] => Array(
[Cache-Control] => max-age=2592000000
[Expires] => Wed, 11 Apr 2096 20:25:37 GMT
)
[path] => f/l/1767_1422890642.png
)

                            [resize] => Array
                                (
                                    [width] => 100
                                    [strategy] => landscape
                                )

)

$original_response = Kraken::upload($original_upload_params);

Its giving me an error
Array
(
[message] => Error while pushing file to S3: Expected params.Expires to be a Date object, ISO-8601 string, or a UNIX timestamp
[success] =>
)

Please format your Expires date as ISO-8601, for example:

$datetime = new DateTime('23 Mar 2015');
$expires = $datetime->format('c');

and than simply use $expires variable as a value of Expires header in the S3 section.

This does not seem to actually work.

This, for instance, does not work and returns the error message in the original reporter's post:

$datetime = new DateTime('23 Mar 2016');
$expires = $datetime->format('c');

    $response['isodate'] = $expires;

    $this->params["s3_store"] = array(
                                    "key"       =>  $this->s3_aws,
                                    "secret"    =>  $this->s3_secret,
                                    "bucket"    =>  "bucket",
                                    "path"      =>  $destination_path,
                                    "headers"   =>  array(
                                        "Cache-Control"     =>"max-age=2592000000",
                                        "Expires"           =>$expires
                                    )
                                );
}

`$datetime = new DateTime('23 Mar 2016');
$expires = $datetime->format('c');

$response['isodate'] = $expires;

$this->params["s3_store"] = array(
                                "key"       =>  $this->s3_aws,
                                "secret"    =>  $this->s3_secret,
                                "bucket"    =>  "bucket",
                                "path"      =>  $destination_path,
                                "headers"   =>  array(
                                    "Cache-Control"     =>"max-age=2592000000",
                                    "Expires"           =>strtotime($expires)
                                )
                            );

}`