PHP code example of miroslavtima / aws-sdk-nette-extension
1. Go to this page and download the library: Download miroslavtima/aws-sdk-nette-extension 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/ */
miroslavtima / aws-sdk-nette-extension example snippets
class S3Service
{
/**
* @var \Aws\S3\S3Client
*/
public $s3;
public function __construct(\Aws\Sdk $sdk)
{
$this->s3 = $sdk->createS3();
}
public function save($path_to_file)
{
$this->s3->putObject([
'Bucket' => 'YourBucket',
'Key' => 'YourObjectKey',
'SourceFile' => $path_to_file,
]);
}
}
class HomepagePresenter extends Presenter
{
/**
* @var S3Service
* @inject
*/
public $service;
public function actionDefault()
{
$this->service->save('/path/to/file');
}
}