PHP code example of sampohaavisto / aws-sdk-php-forked-v3

1. Go to this page and download the library: Download sampohaavisto/aws-sdk-php-forked-v3 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sampohaavisto / aws-sdk-php-forked-v3 example snippets



// Require the Composer autoloader.
 Amazon S3 client.
$s3 = new S3Client([
    'version' => 'latest',
    'region'  => 'us-west-2'
]);


// Upload a publicly accessible file. The file size and type are determined by the SDK.
try {
    $s3->putObject([
        'Bucket' => 'my-bucket',
        'Key'    => 'my-object',
        'Body'   => fopen('/path/to/file', 'r'),
        'ACL'    => 'public-read',
    ]);
} catch (Aws3\S3\Exception\S3Exception $e) {
    echo "There was an error uploading the file.\n";
}