$arResult[«FORM_HEADER»]

Отпарвка формы с вложенными файлами.

28.07.2016 Bitrix, php ,

function OnOnBeforeEventAdd(&$event, &$lid, &$arFields, &$message_id, &$files){
    if ($event == 'ololo_form_event') {		
        $isFiltered = false;
		$by="s_id";
		$order="desc";
		/// код совойства в которм должны быть файлы
		$arFilterField = Array(
			"SID"	=> "FILE_CODE_QUESTION"
		);
		$rsQuestions = CFormField::GetList(
			$arFields['RS_FORM_ID'], 
			"N", 
			$by, 
			$order, 
			$arFilterField, 
			$isFiltered
		);
		if($isFiltered){		
			if ($arQuestion = $rsQuestions->Fetch()){
				$arFilterAnswer = Array(
					"FIELD_TYPE" => "file",
				);
				$rsAnswers = CFormAnswer::GetList(
					$arQuestion['ID'], 
					$by, 
					$order, 
					$arFilterAnswer, 
					$isFiltered
				);
				if($isFiltered){
					while ($arAnswer = $rsAnswers->Fetch()){
						$file = CFormResult::GetFileByAnswerID($arFields['RS_RESULT_ID'], $arAnswer['ID']);
						if(intval($file['USER_FILE_ID']) > 0){
							$files[] = $file['USER_FILE_ID'];
						}
					}						
				}					
			}				
		}
        return $arFields;
    }
}

bitrix forms $arResult[«FORM_HEADER»]

26.03.2012 Bitrix No comments

unset($arResult["FORM_HEADER"]);

$arResult["FORM_HEADER"] = "</pre>
<form class="odd_form" 
action="'&quot;.$APPLICATION-" name="&quot;.
$arResult[" onsubmit="check_fields()">GetCurPage()."'
method='POST' enctype='multipart/form-data' 
style='width: 90%;'>".bitrix_sessid_post()."
<input id="" type="hidden" name="WEB_FORM_ID" value="&quot;.$arResult[" />";