Skip to content

Instantly share code, notes, and snippets.

@r--w
Created January 29, 2015 12:54
Show Gist options
  • Save r--w/503103e4453faf69907d to your computer and use it in GitHub Desktop.
Save r--w/503103e4453faf69907d to your computer and use it in GitHub Desktop.
e24-working example
public function aws() {
$bucket = "bucket";
$key = "your-key";
$secret = "your-secret";
$base = "http://e24files.com/";
$s3 = \Aws\S3\S3Client::factory([
"key" => $key,
"secret" => $secret,
"base_url" => $base,
]);
try {
$s3->putObject(array(
'Bucket' => $bucket,
'Key' => "test.1",
'Body' => fopen("/tmp/zumi.sh", 'r'),
'ACL' => 'public-read',
"PathStyle" => true
));
} catch (S3Exception $e) {
echo "There was an error uploading the file.\n";
}
var_dump($s3->getObjectUrl($bucket, "test.1", null, ["PathStyle" => true]));
$objects = $s3->getIterator('ListObjects', ["Bucket" => $bucket, "PathStyle" => true]);
foreach ($objects as $o) {
var_dump($o);
}
die("End");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment