上传时设置存储类

时间:2017-05-25 10:25:37

标签: php google-cloud-storage

目前我使用以下代码将文件上传到我的存储桶:

function upload_file_to_gcs($source, $des) {
    global $gcs;
    $bucketName = 'example';
    $file = fopen($source, 'r');
    $bucket = $gcs->bucket($bucketName);
    try {
        $result = $bucket->upload($file, [
            'name' => $des,
            'Content-Type' => 'application/zip'
        ]);
    }
}

但是现在我要设置存储类,这个文件应该上传到。我怎样才能做到这一点? 在亚马逊AWS中,我能够简单地设置存储类,如:

$result = $s3->putObject([
    'Bucket' => 'example',
    'Key'    => 'folder/'.$des,
    'StorageClass' => 'STANDARD_IA',     // <--- Simple options command
    'ServerSideEncryption' => 'AES256',
    'SourceFile'   => $source,
    'Content-Type' => 'application/zip'
]);

但我如何使用Google存储空间执行此操作?我在文档中找不到任何选项: http://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.31.1/storage/bucket?method=upload

1 个答案:

答案 0 :(得分:2)

这有用吗?

spring.datasource.url=jdbc:derby://10.12.1.1:1527/example1;create=true
spring.datasource.username=test1
spring.datasource.password=pass1
spring.datasource.driver-class-name=org.apache.derby.jdbc.ClientDriver
相关问题