Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Hello.
Previously, it was not possible to do this, I had to open the kernel ...
Apparently, without a custom component, it will not work. When loading through the standard type=file field, the data about the file gets into the $_FILES array where there is tmp_name - the full path to the temporary file, and when using \Bitrix\Main\UI\FileInput in $_REQUEST where there is also tmp_name but with a truncated value
should be
In the component CIBlockElement::Add is called next -
CIBlockElement::Add --> CFile::CheckImageFile --> CFile::GetImageSize($arFile["tmp_name"], true, $flashEnabled)
if($arResult["PROPERTY_LIST_FULL"][$propertyID]["PROPERTY_TYPE"] == "F")
замени
$arFile = $_FILES["PROPERTY_FILE_".$propertyID."_0"];
на
$arFile = ($_FILES["PROPERTY_FILE_".$propertyID."_0"] ? $_FILES["PROPERTY_FILE_".$propertyID."_0"] : CIBlock::makeFileArray($_REQUEST["PROPERTY_FILE_".$propertyID."_0"]));
for ($i = 0; $i<$inputNum; $i++)
{
$name = 'PROPERTY_FILE_'.$propertyID.'_'.($arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE_ID"] ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE_ID"] : $i);
$value = intval($propertyID) > 0 ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE"] : $arResult["ELEMENT"][$propertyID];
echo \Bitrix\Main\UI\FileInput::createInstance(array(
"name" => $name,
"description" => true,
"upload" => true,
"allowUpload" => "I",
"medialib" => true,
"fileDialog" => true,
"cloud" => true,
"delete" => true,
"maxCount" => 1
))->show(
$value,
$value ? true : false
);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question