public function save($path, $newName = null) { FilesystemStorage::copy($this->getFullPath(), $path); $this->full_path = $path; if (!is_null($newName)) { $this->name = $newName; } }
/** * @param IFile $file * @param $path * @return IFile */ public function publishFile(IFile $file, $path) { $onlyPath = dirname($path); if (!file_exists($onlyPath)) { FilesystemStorage::mkdir($onlyPath, 0777, true); } $file->save($path); return $file; }