public function store(File $file, $path) { $fullPath = sprintf('%s/%s', $this->config['root_folder'], $path); if (!is_dir($fullPath)) { mkdir($fullPath, 0755, true); } $filePath = sprintf('%s/%s', $fullPath, $file->getFilename()); rename($file->getPathname(), $filePath); $file->setUrl($this->resolveUrl($file)); $file->setName(sprintf('%s/%s', $file->getUploaderPath(), $file->getFilename())); foreach ($file->getEditions() as $edition) { if ($edition->store() === true) { $from_upload_path = sprintf('%s/%s', $edition->getUploaderPath(), $edition->getFilename()); $to_upload_path = sprintf('%s/%s', $path, $edition->getFilename()); $this->move($from_upload_path, $to_upload_path); $edition->setUrl($this->resolveUrl($edition)); } } return $file; }
public function generateName(File $file) { return $file->getFilename(); }