/** * This method is overloaded so that the final target points to a URI using S3 protocol * * {@inheritdoc} */ protected function getFinalTarget($uploadData) { // We cannot upload without a bucket if (null === $this->options['bucket']) { throw new MissingBucketException('No bucket was set when trying to upload a file to S3'); } // Get the tmp file name and convert it to an S3 key $key = trim(str_replace('\\', '/', parent::getFinalTarget($uploadData)), '/'); if (strpos($key, './') === 0) { $key = substr($key, 2); } return "s3://{$this->options['bucket']}/{$key}"; }
/** * {@inheritDoc} */ protected function getFinalTarget($uploadData) { if (is_array($uploadData)) { $this->uploadData = $uploadData; } $target = parent::getFinalTarget($uploadData); $info = pathinfo($target); if ($this->getRandomize()) { $subPath = FileUtils::getStoreSubPath($info['filename'], $this->getStoreLevels()); } if (!$subPath) { return $target; } $info['dirname'] .= DIRECTORY_SEPARATOR . $subPath; if (!is_dir($info['dirname'])) { mkdir($info['dirname'], 0755, true); } $path = realpath($info['dirname']) . DIRECTORY_SEPARATOR . $info['basename']; return $path; }
public function getFinalTarget($uploadData) { return parent::getFinalTarget($uploadData); }
/** * @inheritdoc */ protected function getFinalTarget($uploadData) { return trim(str_replace('\\', '/', parent::getFinalTarget($uploadData)), '/'); }