File::extractValue: Bitrix method

      
<?php 
//  Bitrix\Bizproc\BaseType\File :: extractValue()
//  /dist/bitrix/modules/bizproc/lib/basetype/file.php:303

    
protected static function extractValue(FieldType $fieldType, array $field, array $request)
    {
        
$value parent::extractValue($fieldType$field$request);

        if (
is_array($value) && !empty($value['name']) && !empty($value['tmp_name']))
        {
            if (!
is_uploaded_file($value['tmp_name']))
            {
                
$value null;
                static::
addError([
                    
'code'      => 'ErrorValue',
                    
'message'   => Loc::getMessage('BPDT_FILE_SECURITY_ERROR'),
                    
'parameter' => static::generateControlName($field),
                ]);
            }
            else
            {
                if (!
array_key_exists('MODULE_ID'$value) || strlen($value['MODULE_ID']) <= 0)
                    
$value['MODULE_ID'] = 'bizproc';

                
$value = \CFile::saveFile($value'bizproc_wf'true);
                if (!
$value)
                {
                    
$value null;
                    static::
addError([
                        
'code'      => 'ErrorValue',
                        
'message'   => Loc::getMessage('BPDT_FILE_INVALID'),
                        
'parameter' => static::generateControlName($field),
                    ]);
                }
            }
        }
        elseif (\
CBPActivity::isExpression($value))
        {
            
//It`s OK
        
}
        else
        {
            
$value null;
        }

        return 
$value;
    }