get($file); if (!$fileInfo) { return null; } unset($fileInfo['id'], $fileInfo['nameFs'], $fileInfo['added']); $newFileId = $this->insert($fileInfo); if (!$newFileId) { return null; } $newFile = $baseName . '(' . $newFileId . ')' . $extension; $this->update(array('nameFs' => $newFile), $newFileId); $newFullFile = WWW_PATH . '/' . Qs_ImageFs::WEB_PATH . '/' . $newFile; if (!copy($fullFile, $newFullFile)) { $this->table()->delete('id = ' . $newFileId); return null; } return $newFile; } }