Reputation: 457
i am trying to upload a csv file from a form to my s3 bucket. everything seems to be fine.but i get the error message "Operation not found: PutObject". below is my implementation.
<?php
include 'vendor/autoload.php';
use Aws\Ses\SesClient;
use Aws\S3\Exception\S3Exception;
$expected_filename = $_FILES['file']['tmp_name'];
try{
$client = SesClient::factory(array(
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => array(
'key' => 'mykey************',
'secret' => 'mysecret***************',
),
));
$client->putObject([
'Bucket' => "s3://bitb/bitb2/",
'Key' => $expected_filename,
'SourceFile' => $expected_filename,
]);
}
catch( Exception $x )
{
echo "Error: " . $x->getMessage() . "\n";
}
?>
Upvotes: 1
Views: 855
Reputation: 860
Add the following directive at the beginning of your php file:
use Aws\S3\S3Client;
Your syntax is correct but you're missing the reference to the S3 library from the SDK.
Upvotes: 1