Now, I want to upload an image file to gcp bucket, for that I am using this code:
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'
]);
Where $params
variable contains this
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 ) )