Skip to content

Instantly share code, notes, and snippets.

@anoriar
Created May 29, 2019 20:16
Show Gist options
  • Save anoriar/6bc98361594b8f684f8d8e1e633f41f0 to your computer and use it in GitHub Desktop.
Save anoriar/6bc98361594b8f684f8d8e1e633f41f0 to your computer and use it in GitHub Desktop.
$ftpPath = trim(\Bitrix\Main\Config\Option::get("grain.customsettings","ftp_path"), '/');
$rs = FileTable::getList([
'filter' => ['ID' => $lastProduct['PROPERTY_IMAGES_VALUE']],
'select' => ['ID', 'SUBDIR', 'ORIGINAL_NAME', 'FILE_NAME'],
]);
while ($fileInfo = $rs->Fetch()) {
$newFileName = str_replace($lastProduct['CODE'], $modelCode, $fileInfo['ORIGINAL_NAME']);
copy($_SERVER["DOCUMENT_ROOT"] . $ftpPath . '/' . $newFileName, $_SERVER["DOCUMENT_ROOT"] . 'upload/' . $fileInfo['SUBDIR'] . '/' . $fileInfo['FILE_NAME']);
$filesTable[$fileInfo["ID"]] = $fileInfo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment