当前位置: 首页>>代码示例>>PHP>>正文


PHP CFile::ConvertFilesToPost方法代码示例

本文整理汇总了PHP中CFile::ConvertFilesToPost方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::ConvertFilesToPost方法的具体用法?PHP CFile::ConvertFilesToPost怎么用?PHP CFile::ConvertFilesToPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFile的用法示例。


在下文中一共展示了CFile::ConvertFilesToPost方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processActionCheckDataElementCreation

 protected function processActionCheckDataElementCreation()
 {
     if ($_POST["save"] != "Y" && $_POST["changePostFormTab"] != "lists" && !check_bitrix_sessid()) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
     }
     if (!Loader::IncludeModule('bizproc')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_BIZPROC'))));
     }
     if (!Loader::includeModule('iblock')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
     }
     $this->iblockId = intval($this->request->getPost('IBLOCK_ID'));
     $this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $this->checkPermissionElement();
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $templateId = intval($_POST['TEMPLATE_ID']);
     $documentType = BizprocDocument::generateDocumentComplexType(COption::GetOptionString("lists", "livefeed_iblock_type_id"), $this->iblockId);
     if (!empty($templateId)) {
         if (CModule::IncludeModule('bizproc')) {
             if (!CBPWorkflowTemplateLoader::isConstantsTuned($templateId)) {
                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_CONSTANTS_TUNED_NEW'))));
                 $this->sendJsonErrorResponse();
             }
         }
     } else {
         if (CModule::IncludeModule("bizproc")) {
             $templateObject = CBPWorkflowTemplateLoader::getTemplatesList(array('ID' => 'DESC'), array('DOCUMENT_TYPE' => $documentType, 'AUTO_EXECUTE' => CBPDocumentEventType::Create), false, false, array('ID'));
             $template = $templateObject->fetch();
             if (!empty($template)) {
                 if (!CBPWorkflowTemplateLoader::isConstantsTuned($template["ID"])) {
                     $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_CONSTANTS_TUNED_NEW'))));
                     $this->sendJsonErrorResponse();
                 }
             } else {
                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_NOT_BIZPROC_TEMPLATE'))));
                 $this->sendJsonErrorResponse();
             }
         }
     }
     $list = new CList($this->iblockId);
     $fields = $list->getFields();
     $elementData = array("IBLOCK_ID" => $this->iblockId, "NAME" => $_POST["NAME"]);
     $props = array();
     foreach ($fields as $fieldId => $field) {
         if ($fieldId == "PREVIEW_PICTURE" || $fieldId == "DETAIL_PICTURE") {
             $elementData[$fieldId] = $_FILES[$fieldId];
             if (isset($_POST[$fieldId . "_del"]) && $_POST[$fieldId . "_del"] == "Y") {
                 $elementData[$fieldId]["del"] = "Y";
             }
         } elseif ($fieldId == "PREVIEW_TEXT" || $fieldId == "DETAIL_TEXT") {
             if (isset($field["SETTINGS"]) && is_array($field["SETTINGS"]) && $field["SETTINGS"]["USE_EDITOR"] == "Y") {
                 $elementData[$fieldId . "_TYPE"] = "html";
             } else {
                 $elementData[$fieldId . "_TYPE"] = "text";
             }
             $elementData[$fieldId] = $_POST[$fieldId];
         } elseif ($fieldId == 'ACTIVE_FROM' || $fieldId == 'ACTIVE_TO') {
             $elementData[$fieldId] = array_shift($_POST[$fieldId]);
         } elseif ($list->is_field($fieldId)) {
             $elementData[$fieldId] = $_POST[$fieldId];
         } elseif ($field["PROPERTY_TYPE"] == "F") {
             if (isset($_POST[$fieldId . "_del"])) {
                 $deleteArray = $_POST[$fieldId . "_del"];
             } else {
                 $deleteArray = array();
             }
             $props[$field["ID"]] = array();
             $files = $this->unEscape($_FILES);
             CFile::ConvertFilesToPost($files[$fieldId], $props[$field["ID"]]);
             foreach ($props[$field["ID"]] as $fileId => $file) {
                 if (isset($deleteArray[$fileId]) && (!is_array($deleteArray[$fileId]) && $deleteArray[$fileId] == "Y" || is_array($deleteArray[$fileId]) && $deleteArray[$fileId]["VALUE"] == "Y")) {
                     if (isset($props[$field["ID"]][$fileId]["VALUE"])) {
                         $props[$field["ID"]][$fileId]["VALUE"]["del"] = "Y";
                     } else {
                         $props[$field["ID"]][$fileId]["del"] = "Y";
                     }
                 }
             }
         } elseif ($field["PROPERTY_TYPE"] == "N") {
             if (is_array($_POST[$fieldId]) && !array_key_exists("VALUE", $_POST[$fieldId])) {
                 $props[$field["ID"]] = array();
                 foreach ($_POST[$fieldId] as $key => $value) {
                     if (is_array($value)) {
                         if (strlen($value["VALUE"])) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value["VALUE"]));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
                             $props[$field["ID"]][$key] = doubleval($value);
                         }
                     } else {
                         if (strlen($value)) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:ajax.php

示例2: array

                 $fieldType = 'boolean';
                 break;
             default:
                 $fieldType = 'string';
         }
         $arUserField = array("ENTITY_ID" => "HLBLOCK_" . $highBlockID, "FIELD_NAME" => $fieldName, "USER_TYPE_ID" => $fieldType, "XML_ID" => "", "SORT" => $intSortStep, "MULTIPLE" => "N", "MANDATORY" => $fieldMandatory, "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "Y", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array());
         if (isset($_POST['PROPERTY_USER_TYPE_SETTINGS']['LANG'][$fieldName])) {
             $arUserField["EDIT_FORM_LABEL"] = $arUserField["LIST_COLUMN_LABEL"] = $arUserField["LIST_FILTER_LABEL"] = array(LANGUAGE_ID => $_POST['PROPERTY_USER_TYPE_SETTINGS']['LANG'][$fieldName]);
         }
         $obUserField->Add($arUserField);
         $intSortStep += 100;
     }
 }
 $arImageResult = array();
 if (isset($_FILES['PROPERTY_DIRECTORY_VALUES']) && is_array($_FILES['PROPERTY_DIRECTORY_VALUES'])) {
     CFile::ConvertFilesToPost($_FILES['PROPERTY_DIRECTORY_VALUES'], $arImageResult);
 }
 if ($_POST["PROPERTY_USER_TYPE_SETTINGS"]["TABLE_NAME"] == '-1' && isset($result) && $result->isSuccess()) {
     $hlblock = Bitrix\Highloadblock\HighloadBlockTable::getById($highBlockID)->fetch();
 } else {
     $hlblock = Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('=TABLE_NAME' => $_POST['PROPERTY_USER_TYPE_SETTINGS']['TABLE_NAME'])))->fetch();
 }
 $entity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
 $entityDataClass = $entity->getDataClass();
 $fieldsList = $entityDataClass::getMap();
 if (count($fieldsList) == 1 && isset($fieldsList['ID'])) {
     $fieldsList = $entityDataClass::getEntity()->getFields();
 }
 foreach ($_POST['PROPERTY_DIRECTORY_VALUES'] as $dirKey => $arDirValue) {
     if (isset($arDirValue["UF_DELETE"])) {
         if ($arDirValue["UF_DELETE"] === 'Y') {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_edit_property.php

示例3: EditFormAddFields

	function EditFormAddFields($entity_id, &$arFields)
	{
		global $HTTP_POST_FILES;
		$arUserFields = $this->GetUserFields($entity_id);
		foreach($arUserFields as $arUserField)
		{
			if($arUserField["EDIT_IN_LIST"]=="Y")
			{
				if($arUserField["USER_TYPE"]["BASE_TYPE"]=="file")
				{
					if (isset($HTTP_POST_FILES[$arUserField["FIELD_NAME"]]))
					{
						if(is_array($HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["name"]))
						{
							$arFields[$arUserField["FIELD_NAME"]] = array();
							foreach($HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["name"] as $key => $value)
							{
								$old_id = $GLOBALS[$arUserField["FIELD_NAME"]."_old_id"][$key];
								$arFields[$arUserField["FIELD_NAME"]][$key] = array(
									"name" => $HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["name"][$key],
									"type" => $HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["type"][$key],
									"tmp_name" => $HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["tmp_name"][$key],
									"error" => $HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["error"][$key],
									"size" => $HTTP_POST_FILES[$arUserField["FIELD_NAME"]]["size"][$key],
									"del" => is_array($GLOBALS[$arUserField["FIELD_NAME"]."_del"]) &&
											(	in_array($old_id, $GLOBALS[$arUserField["FIELD_NAME"]."_del"]) ||
												(
													array_key_exists($key, $GLOBALS[$arUserField["FIELD_NAME"]."_del"]) &&
													$GLOBALS[$arUserField["FIELD_NAME"]."_del"][$key] == "Y"
												)
											),
									"old_id" => $old_id
								);
							}
						}
						else
						{
							$arFields[$arUserField["FIELD_NAME"]] = $HTTP_POST_FILES[$arUserField["FIELD_NAME"]];
							$arFields[$arUserField["FIELD_NAME"]]["del"] = $GLOBALS[$arUserField["FIELD_NAME"]."_del"];
							$arFields[$arUserField["FIELD_NAME"]]["old_id"] = $GLOBALS[$arUserField["FIELD_NAME"]."_old_id"];
						}
					}
					else
					{
						if(isset($GLOBALS[$arUserField["FIELD_NAME"]]))
						{
							if(!is_array($GLOBALS[$arUserField["FIELD_NAME"]]))
							{
								if(intval($GLOBALS[$arUserField["FIELD_NAME"]]) > 0)
								{
									$arFields[$arUserField["FIELD_NAME"]] = intval($GLOBALS[$arUserField["FIELD_NAME"]]);
								}
							}
							else
							{
								$fields = array();
								foreach($GLOBALS[$arUserField["FIELD_NAME"]] as $val)
								{
									if(intval($val) > 0)
									{
										$fields[] = intval($val);
									}
								}
								$arFields[$arUserField["FIELD_NAME"]] = $fields;
							}
						}
					}
				}
				else
				{
					if (isset($HTTP_POST_FILES[$arUserField["FIELD_NAME"]]))
					{
						$arFile = array();
						CFile::ConvertFilesToPost($HTTP_POST_FILES[$arUserField["FIELD_NAME"]], $arFile);

						if(isset($GLOBALS[$arUserField["FIELD_NAME"]]))
						{
							if($arUserField["MULTIPLE"] == "Y")
							{
								foreach($_REQUEST[$arUserField["FIELD_NAME"]] as $key => $value)
									$arFields[$arUserField["FIELD_NAME"]][$key] = array_merge($value, $arFile[$key]);
							}
							else
							{
								$arFields[$arUserField["FIELD_NAME"]] = array_merge($_REQUEST[$arUserField["FIELD_NAME"]], $arFile);
							}
						}
						else
						{
							$arFields[$arUserField["FIELD_NAME"]] = $arFile;
						}
					}
					else
					{
						if(isset($GLOBALS[$arUserField["FIELD_NAME"]]))
							$arFields[$arUserField["FIELD_NAME"]] = $GLOBALS[$arUserField["FIELD_NAME"]];
					}

				}
			}
//.........这里部分代码省略.........
开发者ID:nycmic,项目名称:bittest,代码行数:101,代码来源:usertype.php

示例4: elseif

     if (isset($arField["SETTINGS"]) && is_array($arField["SETTINGS"]) && $arField["SETTINGS"]["USE_EDITOR"] == "Y") {
         $arElement[$FIELD_ID . "_TYPE"] = "html";
     } else {
         $arElement[$FIELD_ID . "_TYPE"] = "text";
     }
     $arElement[$FIELD_ID] = $_POST[$FIELD_ID];
 } elseif ($obList->is_field($FIELD_ID)) {
     $arElement[$FIELD_ID] = $_POST[$FIELD_ID];
 } elseif ($arField["PROPERTY_TYPE"] == "F") {
     if (isset($_POST[$FIELD_ID . "_del"])) {
         $arDel = $_POST[$FIELD_ID . "_del"];
     } else {
         $arDel = array();
     }
     $arProps[$arField["ID"]] = array();
     CFile::ConvertFilesToPost($_FILES[$FIELD_ID], $arProps[$arField["ID"]]);
     foreach ($arProps[$arField["ID"]] as $file_id => $arFile) {
         if (isset($arDel[$file_id]) && (!is_array($arDel[$file_id]) && $arDel[$file_id] == "Y" || is_array($arDel[$file_id]) && $arDel[$file_id]["VALUE"] == "Y")) {
             if (isset($arProps[$arField["ID"]][$file_id]["VALUE"])) {
                 $arProps[$arField["ID"]][$file_id]["VALUE"]["del"] = "Y";
             } else {
                 $arProps[$arField["ID"]][$file_id]["del"] = "Y";
             }
         }
     }
 } elseif ($arField["PROPERTY_TYPE"] == "N") {
     if (is_array($_POST[$FIELD_ID]) && !array_key_exists("VALUE", $_POST[$FIELD_ID])) {
         $arProps[$arField["ID"]] = array();
         foreach ($_POST[$FIELD_ID] as $key => $value) {
             if (is_array($value)) {
                 if (strlen($value["VALUE"])) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例5: __showPopup

}
if (!empty($arPropertyPopupIB1)) {
    __showPopup("IB_SEG_ADD_PROP_IN_TITLE", $arPropertyPopupIB1);
}
$arPropertyPopupIB2 = array("NAME" => array("TEXT" => GetMessage("IB_SEG_TITLE"), "ONCLICK" => "obPropertyTable.addPropertyInTitle('{=this.property.CML2_LINK.NAME}')", "CODE" => 'NAME'));
foreach ($arAllParentProperties as $key => $property) {
    $arPropertyPopupIB2[$property["CODE"]] = array("TEXT" => htmlspecialcharsbx($property["NAME"]), "ONCLICK" => "obPropertyTable.addPropertyInTitle('{=this.property.CML2_LINK.property." . $property["CODE"] . "}')", "CODE" => $property["CODE"]);
}
if (!empty($arPropertyPopupIB2)) {
    __showPopup("IB_SEG_ADD_PROP_IN_TITLE2", $arPropertyPopupIB2);
}
$errorMessage = '';
if (!$bReadOnly && check_bitrix_sessid()) {
    $arImageCombinationResult = $arPropertyValueCombinationResult = array();
    if (isset($_FILES['PROP']) && is_array($_FILES['PROP'])) {
        CFile::ConvertFilesToPost($_FILES['PROP'], $arImageCombinationResult);
    }
    if (isset($_POST["PROP"]) && is_array($_POST["PROP"])) {
        foreach ($_POST["PROP"] as $propKey => $arTmpProperty) {
            $rowId = 0;
            if (is_array($arTmpProperty)) {
                foreach ($arTmpProperty as $eachPropertyValue) {
                    $arPropertyValueCombinationResult[$rowId][$propKey] = $eachPropertyValue;
                    $rowId++;
                }
            }
        }
    }
    $arCombinationResult = $arPropertyValue = $arPriceGroup = array();
    $idNewElement = false;
    $obIBlockElement = new CIBlockElement();
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_subelement_generator.php

示例6: array

 if ($productID <= 0) {
     // Setup catalog ID for new product
     $productFields['CATALOG_ID'] = $catalogID > 0 ? $catalogID : CCrmCatalog::EnsureDefaultExists();
 }
 // Product properties values
 $arPropsValues = array();
 foreach ($arResult['PROPS'] as $propID => $arProp) {
     if ($arProp['PROPERTY_TYPE'] == 'F') {
         if (isset($_POST[$propID . '_del'])) {
             $arDel = $_POST[$propID . '_del'];
         } else {
             $arDel = array();
         }
         $arPropsValues[$arProp['ID']] = array();
         if (isset($_FILES[$propID])) {
             CFile::ConvertFilesToPost($_FILES[$propID], $arPropsValues[$arProp['ID']]);
             foreach ($arPropsValues[$arProp['ID']] as $file_id => $arFile) {
                 if (isset($arDel[$file_id]) && (!is_array($arDel[$file_id]) && $arDel[$file_id] == 'Y' || is_array($arDel[$file_id]) && $arDel[$file_id]['VALUE'] == 'Y')) {
                     if (isset($arPropsValues[$arProp['ID']][$file_id]['VALUE'])) {
                         $arPropsValues[$arProp['ID']][$file_id]['VALUE']['del'] = 'Y';
                     } else {
                         $arPropsValues[$arProp['ID']][$file_id]['del'] = 'Y';
                     }
                 }
             }
         }
     } elseif ($arProp['PROPERTY_TYPE'] == 'N') {
         if (is_array($_POST[$propID]) && !array_key_exists('VALUE', $_POST[$propID])) {
             $arPropsValues[$arProp['ID']] = array();
             foreach ($_POST[$propID] as $key => $value) {
                 if (is_array($value)) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


注:本文中的CFile::ConvertFilesToPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。