Created
January 29, 2015 12:54
-
-
Save r--w/503103e4453faf69907d to your computer and use it in GitHub Desktop.
e24-working example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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