Documentation

CopyFile

int
CFile::CopyFile(
 int file_id,
 bool Register = true,
 newPath = ""
)

The meethod copies the registered file and returns the ID of a copy. Static method.

Be advised, this methods has been deprecated. It's recommended to use the method CFile::AddDuplicate instead.

Parameters

ParameterDescription Available from version
file_id Numerical indicator of the file to be copied.
Register Optional parameter. If false is specified in the Register, the file will not registered in the file registrar table. The function will return true, if the file will be successfully copied.
newPath Optional parameter. It is specified relative to $_SERVER['DOCUMENT_ROOT'].'/upload/'

See Also

Examples of use

<?
if ($rsElements = GetIBlockElementListEx($IBLOCK_TYPE, $IBLOCK_ID, false, array($ELEMENT_SORT_FIELD => $ELEMENT_SORT_ORDER, "ID" => "ASC"), false, $arrFilter)):
    $rsElements->NavStart($PAGE_ELEMENT_COUNT);
	while ($obElement = $rsElements->GetNextElement()):
		$arElement = $obElement->GetFields();
		$arrNewImages[$arElement["ID"]][] = CFile::CopyFile($arElement["PREVIEW_PICTURE"]);
	endwhile;
endif;
?>


© «Bitrix24», 2001-2024
Up