我有以下代码,它正常工作直到使用上传功能。然后我得到错误 -
在非对象上调用成员函数upload()。
我理解错误意味着什么,但我不知道为什么?有任何想法吗。谷歌搜索了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";
}