putObject() публичный Метод

Adds an object to a bucket.
public putObject ( string $bucket, string $key, string $content, array $params = [] ) : mixed
$bucket string
$key string
$content string
$params array
Результат mixed
Пример #1
0
 /**
  * @inheritdoc
  */
 public function setContents($key, $contents, $append = false)
 {
     $this->recentKey = $key;
     $params = $this->params;
     $params['ACL'] = 'public-read';
     $this->recentFiles[$key] = $this->s3Client->putObject($this->bucket, $key, $contents, $params);
     return true;
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function setContents($key, $contents, $append = false)
 {
     $this->recentKey = $key;
     $params = ['ACL' => 'public-read'];
     if (is_array($this->meta)) {
         $params['Metadata'] = $this->meta;
     }
     $this->recentFiles[$key] = $this->s3Client->putObject($this->bucket, $key, $contents, $params);
     return true;
 }
Пример #3
0
 /**
  * @dataProvider driverSet
  */
 public function testAmazon(S3 $S3)
 {
     $S3->createBucket($this->bucket);
     $this->assertTrue($S3->doesBucketExist($this->bucket));
     $S3->putObject($this->bucket, $this->key, 'Component test');
     $this->assertTrue($S3->doesObjectExist($this->bucket, $this->key));
     $this->assertSame('Component test', (string) $S3->getObject($this->bucket, $this->key)['Body']);
     $S3->deleteObject($this->bucket, $this->key);
     $this->assertFalse($S3->doesObjectExist($this->bucket, $this->key));
     $S3->deleteBucket($this->bucket);
     $this->assertFalse($S3->doesBucketExist($this->bucket));
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 public function setContents($key, $contents, $append = false)
 {
     if ($this->dateFolderStructure) {
         if (!$this->keyExists($key)) {
             $key = new StringObject($key);
             $key = date('Y/m/d') . '/' . $key->trimLeft('/');
         }
     }
     $this->recentKey = $key;
     $params = ['ACL' => 'public-read'];
     $this->recentFiles[$key] = $this->s3Client->putObject($this->bucket, $key, $contents, $params);
     return true;
 }