/**
  * {@inheritdoc}
  */
 public function upload(FileInterface $file, $name, $path = null)
 {
     $path = is_null($path) ? $name : sprintf('%s/%s', $path, $name);
     $path = sprintf('%s/%s', $this->directory, $path);
     $directory = dirname($path);
     $name = basename($path);
     /** @var \Symfony\Component\HttpFoundation\File\File */
     $target = $file->move($directory, $name);
     return $target;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function name(FileInterface $file)
 {
     return sprintf('%s.%s', uniqid(), $file->getExtension());
 }