- Модуль: ui
- Путь к файлу: ~/bitrix/modules/ui/lib/FileUploader/TempFile.php
- Класс: BitrixUIFileUploaderTempFile
- Вызов: TempFile::commit
public function commit(CommitOptions $commitOptions): Result
{
$fileAbsolutePath = $this->getAbsolutePath();
$fileId = CFile::saveFile(
[
'name' => $this->getFilename(),
'tmp_name' => $fileAbsolutePath,
'type' => $this->getMimetype(),
'MODULE_ID' => $commitOptions->getModuleId(),
'width' => $this->getWidth(),
'height' => $this->getHeight(),
],
$commitOptions->getSavePath(),
$commitOptions->isForceRandom(),
$commitOptions->isSkipExtension(),
$commitOptions->getAddDirectory()
);
$result = new Result();
if (!$fileId)
{
$this->delete();
return $result->addError(new UploaderError(UploaderError::SAVE_FILE_FAILED));
}
$this->setFileId($fileId);
$this->setUploaded(true);
$this->save();
$this->fillFile();
$this->removeActualTempFile();
return $result;
}