Esempio n. 1
0
 /**
  * Transfer an object to the S3 storage bucket.
  *
  * @access public
  * @param string $path
  * @return string
  */
 public function transfer($path)
 {
     if ($this->s3 === null) {
         return $path;
     }
     $name = $this->s3->path . basename($path);
     $bucket = $this->s3->bucket;
     if ($this->s3->putObjectFile($this->uploader->formatPath($path), $bucket, $name, S3::ACL_PUBLIC_READ)) {
         $this->s3->uploads[] = $path;
         return sprintf('http://%s.%s/%s', $bucket, self::AS3_DOMAIN, $name);
     }
     return $path;
 }
Esempio n. 2
0
 /**
  * Transfer an object to the S3 storage bucket.
  *
  * @access public
  * @param string $path
  * @return string
  */
 public function transfer($path)
 {
     if ($this->s3 === null) {
         return $path;
     }
     $host = empty($this->s3->host) ? self::AS3_DOMAIN : $this->s3->host;
     $name = basename($path);
     $bucket = $this->s3->bucket;
     if (!empty($this->s3->path)) {
         $name = $this->s3->path . '/' . $name;
     }
     if ($this->s3->putObjectFile($this->uploader->formatPath($path), $bucket, $name, S3::ACL_PUBLIC_READ)) {
         $this->s3->uploads[] = $path;
         return String::insert($this->s3->format, array('bucket' => $bucket, 'path' => $name, 'host' => $host), array('before' => '{', 'after' => '}'));
     }
     return $path;
 }