Skip to content

Instantly share code, notes, and snippets.

@clagiordano
Created April 27, 2016 08:07
Show Gist options
  • Save clagiordano/209baec5734b9547e6b308dfbccd6ef7 to your computer and use it in GitHub Desktop.
Save clagiordano/209baec5734b9547e6b308dfbccd6ef7 to your computer and use it in GitHub Desktop.
Sample upload with limited account
<?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