- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/tmpfile.php
- Класс: BitrixDiskBitrix24DiskTmpFile
- Вызов: TmpFile::createInBucketFirstPartFromFileArray
static function createInBucketFirstPartFromFileArray(array $fileData, array $data, CCloudStorageBucket $bucket, array $params, ErrorCollection $errorCollection)
{
$data = static::prepareDataToInsertFromFileArray($fileData, $data, $errorCollection);
$data['IS_CLOUD'] = 1;
/** @noinspection PhpUndefinedFieldInspection */
$data['BUCKET_ID'] = $bucket->ID;
$model = static::add($data, $errorCollection);
if(!$model)
{
return null;
}
$uploadStatus = $model->appendContentCloud(
IOFile::getFileContents($model->getAbsoluteNonCloudPath()),
$params['startRange'],
$params['endRange'],
$params['fileSize'],
$model->getContentType()
);
if(!$uploadStatus)
{
$errorCollection->add($model->getErrors());
//todo Are we right?
$model->delete();
unset($model);
return null;
}
return $model;
}