Answer the question
In order to leave comments, you need to log in
How to fill in a multiple property file in Bitrix?
$arFiles = array();
for($i = 0; $i < count($_FILES["photo_ar"]['name']); $i++)
{
if($_FILES["photo_ar"]['tmp_name'][$i])
$arFiles[] = array('VALUE' => CFile::MakeFileArray($_FILES["photo_ar"]['tmp_name'][$i]), 'DESCRIPTION' => '');
}
$arFields = array(
"IBLOCK_ID" => 7,
"NAME" => $head,
"PROPERTY_VALUES" => array("PHOTO" => $arFiles)
);
$oElement = new CIBlockElement();
$idElement = $oElement->Add($arFields, false, false, true);
Answer the question
In order to leave comments, you need to log in
Разобрался, не нужно облекать массив в CFile::MakeFileArray, просто нужно было переопределить многомерный массив в более простой, типа:
$file = Array
(
'name' => $_FILES["photo_ar"]['name'][$i],
'size' => $_FILES["photo_ar"]['size'][$i],
'tmp_name' => $_FILES["photo_ar"]['tmp_name'][$i],
'type' => $_FILES["photo_ar"]['type'][$i]
);
$arFiles[] = array('VALUE' => $file, 'DESCRIPTION' => '');
А что получается в массиве $arFields? Возможно ошибка в пути к файлу в CFile::MakeFileArray или в правах доступа.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question