我尝试通过PHP将图像上传到Google云端存储中的存储桶(我的服务器代码处理上传到Google)
文件上传正常,但类型(在浏览器中查找时)为application/octet-stream
我的错误在哪里?
$data = file_get_contents('<local file path>.jpg');
$gso = new Google_Service_Storage_StorageObject();
$gso->setName("test8.jpg");
$gso->setContentType('image/jpeg');
$postbody = array('uploadType' => 'multipart', 'data' => $data);
$ret = $service->objects->insert($user_bucket, $gso, $postbody);