tpyo / amazon-s3-php-class

A standalone Amazon S3 (REST) client for PHP 5/CURL
1.03k stars 503 forks source link

How getObject content without saving to file? #137

Closed nezarat closed 5 years ago

nezarat commented 7 years ago

I want to get the Object data without saving it to file and read it back. Use this file: $tmp = '/tmp/tmpfile'; S3::setAuth($app->config("app.s3_api_id"), $app->config("app.s3_api_key")); S3::getObject($app->config("app.s3_bucket"), 'uri/to/file', $tmp); $filecontent= file_get_contents($tmp); unlink($tmp); return $filecontent;

ewwink commented 7 years ago

to return as string you only need 2 parameter

$filecontent = S3::getObject($app->config("app.s3_bucket"), 'uri/to/file');
return $filecontent;