致命错误:在CodeIgneter中调用未定义的方法GuzzleHttp \ Psr7 \ Uri :: composeComponents()

时间:2018-10-09 04:34:02

标签: php amazon-web-services codeigniter amazon-s3 guzzlehttp

任何人都可以帮助我,我遇到以下错误:

  

致命错误:调用未定义的方法GuzzleHttp \ Psr7 \ Uri ::   composeComponents()

任何人都可以帮助修复它吗?谢谢,这是我的脚本:

use Aws\Credentials\Credentials;
use Aws\S3\S3Client;
use Aws\Exception\AwsException;

//JWT
use \Firebase\JWT\JWT;

\Firebase\JWT\JWT::$leeway = 10;

这是我的上传文件脚本:

$s3 = new Aws\S3\S3Client([
    'version'     => 'latest',
    'region'      => 'ap-southeast-1',
    'credentials' => 'my-credentials'
]);

$handle = fopen($uploadPath.$filename, 'r');
try {
    $result = $s3->putObject([
        'Bucket' => 'my-bucket',    
        'Key'    => 'Campaign/'.$filename,

        //Upload File
        'Body'   => $handle,
        'ACL'    => 'public-read',
        'params' => array('ContentType' => $_FILES['resourceFile']['type'])
    ]);

    // New URL
    $fileURL = $result['ObjectURL'];
    fclose($handle);
    unlink($target);
} catch (Aws\S3\Exception\S3Exception $e) {
    echo $e."\nThere was an error uploading the file.\n";
}

0 个答案:

没有答案