现在,我想将图像文件上传到gcp存储桶,因为我正在使用以下代码:
require __DIR__ . '\vendor\autoload.php';
$storage = new StorageClient();
$file = fopen($params['book']['tmp_name'], 'r');
$bucket = $storage->bucket('fingertips-books');
$object = $bucket->upload($params['book']['name'], [
'name' => 'test.pdf'
]);
其中$params
变量包含此内容
Array ( [type] => PDF [description] => dsds [book] => Array ( [name] => 2017-03-23.pdf [type] => application/pdf [tmp_name] => C:\xampp\tmp\php97AA.tmp [error] => 0 [size] => 45022 ) )