2014-04-11 2 views
1

Google App Engine에 My Codeigniter Project를 Google Cloud Storage와 연결하려면 어떻게해야합니까?Google 클라우드 스토리지를 Google 앱 엔진과 연결하십시오.

아이디어가 있으십니까?

+2

문서 여기 https://developers.google.com/appengine/docs/php/googlestorage/ –

+0

당신이 할 수있는 당신이하려고하는 것에 대한 구체적인 정보를 조금 더 제공 하시겠습니까? https://gae-php-tips.appspot.com/2014/01/15/php-app-engine-apps-and-file-system-concepts/을 참조하십시오. –

답변

0

PHP 클라이언트 라이브러리 [1]를 사용할 수 있습니다. 여기 양동이에 파일을 업로드하는 예를 HACE :

use Google\Cloud\Storage\StorageClient; 

/** 
* Upload a file. 
* 
* @param string $bucketName the name of your Google Cloud bucket. 
* @param string $objectName the name of the object. 
* @param string $source the path to the file to upload. 
* 
* @return Psr\Http\Message\StreamInterface 
*/ 
function upload_object($bucketName, $objectName, $source) 
{ 
    $storage = new StorageClient(); 
    $file = fopen($source, 'r'); 
    $bucket = $storage->bucket($bucketName); 
    $object = $bucket->upload($file, [ 
     'name' => $objectName 
    ]); 
    printf('Uploaded %s to gs://%s/%s' . PHP_EOL, basename($source), $bucketName, $objectName); 
} 

[1] https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-php

관련 문제