Добавляем событие в init.php
Где:
FORM_FILLING_SIMPLE_FORM_5_2019 — ТИП почтового события
SIMPLE_QUESTION_851 / resume — символьный код заполняемого поля
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('main', "OnBeforeEventAdd", function ($event, $lid, &$arFields, $message_id, &$files) {
if ($event == "FORM_FILLING_SIMPLE_FORM_5_2019" && $arFields["RS_RESULT_ID"]) {
$rs = CFormResult::GetDataByID($arFields["RS_RESULT_ID"], array("SIMPLE_QUESTION_851", "resume"), $arResult, $arAnswers);
if ($arAnswers["SIMPLE_QUESTION_851"]) {
$currFile = current($arAnswers["SIMPLE_QUESTION_851"]);
if ($currFile["USER_FILE_ID"]) {
$files[] = $currFile["USER_FILE_ID"];
}
}
if ($arAnswers["resume"]) {
$currFile = current($arAnswers["resume"]);
if ($currFile["USER_FILE_ID"]) {
$files[] = $currFile["USER_FILE_ID"];
}
}
}
});
