Example #1
0
/**
 * This method copy provided file into repository assuring unique name.
 * Usually the file you want to add to the repository reside in tmp dir or so. Where you had been working on it.
 * After this function is executed, you can safely remove the source file.
 *
 * @param string $file absolute path to file in tmp directory.
 * @param null|string $desiredName desired file name in repository.
 * @return string relative file name in repository.
 * @throws \Ip\Exception
 */
function ipRepositoryAddFile($file, $desiredName = null)
{
    $repositoryModel = \Ip\Internal\Repository\Model::instance();
    return $repositoryModel->addFile($file, $desiredName);
}