I have the following code, which is working correctly up until the point of using the upload function. I then get the error -
Call to a member function upload() on a non-object.
I understand what the error means, but I do not why? Any ideas. Googling has come up with zilch.
require('/libs/s3/aws-autoloader.php');
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
// Instantiate an S3 client
$s3Client = S3Client::factory(array(
'profile' => 'default',
));
try {
$resource = fopen(DRUPAL_ROOT . '/LICENSE.txt', 'r');
$s3->upload('be-production', 'assets', $resource, 'public-read');
} catch (S3Exception $e) {
echo "There was an error uploading the file.\n";
}
Aucun commentaire:
Enregistrer un commentaire