2014-01-21 2 views

답변

0

그런 다음 write apapter라는 디렉터리에 있는지 확인하십시오. 예를 들어 Ftp

public function write($key, $content) 
{ 
    $this->ensureDirectoryExists($this->directory, $this->create); 

    $path = $this->computePath($key); 
    $directory = dirname($path); 

    $this->ensureDirectoryExists($directory, true); 

    ... 
} 

/** 
* Ensures the specified directory exists. If it does not, and the create 
* parameter is set to TRUE, it tries to create it 
*/ 
protected function ensureDirectoryExists($directory, $create = false) 
{ 
    ... 
} 
3

나는 아마존 S3 어댑터를 사용하고, 사용하여 디렉토리를 만들 수 있어요있어 다음

use Gaufrette\Filesystem; 
use Gaufrette\Adapter\AwsS3; 
use Aws\S3\S3Client; 

$s3Service = S3Client::factory(array("key" => "Your Key Here", "secret" => "Your AWS Secret Here")); 
$adapter = new AwsS3($s3Service,"yourBucketNameHere"); 
$filesystem = new Filesystem($adapter); 

$filesystem->write("new-directory-here/", ""); 
+1

솔루션은 Google Cloud Storage에서도 작동합니다. – Alex

0

단순히 Local 어댑터에 true 전달 :

use Gaufrette\Adapter\Local as LocalAdapter; 

... 

$adapter = new LocalAdapter(__DIR__ . '/your-new-dir', true); 
$filesystem = new Filesystem($adapter);