我正在使用League \ Flysystem \ Filesystem和League \ Flysystem \ AwsS3v3 \ AwsS3Adapter将文件上传到Google云存储和s3存储中
$config = [
'credentials' => [
'key' => 'client_key',
'secret' => 'client_secret',
],
'region' => 'client_region',
'version' => 'latest',
];
if($storage_type == 'gcs') {
$config['endpoint'] = 'https://storage.googleapis.com';
}
$s3Client = S3Client::factory($config);
$adapter = new AwsS3Adapter($s3Client,$client_bucket, '');
$filesystem = new Filesystem($adapter);
$stream = $filesystem->readStream('/videos/test.mp4');
$contents = stream_get_contents($stream);
fclose($stream);
$putStream = tmpfile();
fwrite($putStream, $contents);
rewind($putStream);
$response = $filesystem->putStream('videos/sample.mp4',
$putStream);
对于存储类型s3,视频被上传,但不用于云存储。它为Google云存储提供了错误的响应。
Google云存储有什么问题?