Created
April 27, 2016 08:07
-
-
Save clagiordano/209baec5734b9547e6b308dfbccd6ef7 to your computer and use it in GitHub Desktop.
Sample upload with limited account
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
<?php | |
require 'vendor/autoload.php'; | |
use Aws\S3\S3Client; | |
use League\Flysystem\AwsS3v3\AwsS3Adapter; | |
use League\Flysystem\Filesystem; | |
$bucketName = 'YOUR_BUCKET'; | |
$serviceConfig = [ | |
'region' => 'YOUR_REGION', | |
'version' => 'latest', | |
'credentials' => [ | |
'key' => 'YOUR_KEY', | |
'secret' => 'YOUR_SECRET', | |
] | |
]; | |
$s3Client = new S3Client($serviceConfig); | |
$adapterInterface = new AwsS3Adapter($s3Client, $bucketName); | |
$fileSystem = new Filesystem($adapterInterface); | |
$destinationPath = uniqid('test_file_'); | |
$fileSystem->put($destinationPath, "TEST DATA"); | |
$destinationPath = uniqid('test_file_') . ".txt"; | |
$fileSystem->put($destinationPath, "TEST DATA"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment