Simindey
4/6/2017 - 7:04 AM

Загрузка файла в элемент инфоблока

Загрузка файла в элемент инфоблока

<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if($_FILES[DOC][name]){

$ELEMENT_ID = $_POST["ID"];
$PROPERTY_VALUE = "23";

//Множественная загрузка
$arr_file1=Array(
	"name" => $_FILES[DOC][name],
	"size" => $_FILES[DOC][size],
	"tmp_name" => $_FILES[DOC][tmp_name],
	"type" => "",
	"old_file" => "",
	// "del" => "Y",
	"MODULE_ID" => "iblock");

$arr_file2=Array(
	"name" => $_FILES[DOC2][name],
	"size" => $_FILES[DOC2][size],
	"tmp_name" => $_FILES[DOC2][tmp_name],
	"type" => "",
	"old_file" => "",
	// "del" => "Y",
	"MODULE_ID" => "iblock");

$arrNewProps[$PROPERTY_VALUE] = array($arr_file1, $arr_file2);
//Множественная загрузка end

//Одиночная загрузка
$arr_file=Array(
	"name" => $_FILES[DOC][name],
	"size" => $_FILES[DOC][size],
	"tmp_name" => $_FILES[DOC][tmp_name],
	"type" => "",
	"old_file" => "",
	// "del" => "Y",
	"MODULE_ID" => "iblock");

$arrNewProps[$PROPERTY_VALUE] = array("VALUE" =>$arr_file, 'DESCRIPTION' => $arr_file[name]);
//Одиночная загрузка end


CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, false, $arrNewProps);
}