AddEventHandler("iblock", "OnAfterIBlockElementAdd", "OnAfterIBlockElementAddHandler");
function OnAfterIBlockElementAddHandler(&$arFields)
{
$pathaudio = CFile::GetPath($arFields["PROPERTIES"]["MUSICFILE"]["VALUE"]);
$pathaudio = $_SERVER['DOCUMENT_ROOT'].$pathaudio;
if($arFields["IBLOCK_ID"]==28)
{
if (filesize($pathaudio) <= 15000680)
{
$el = new CIBlockElement;
$PROP = array();
$PROP[94] = "$tag[title]";
$PROP[106] = "$tag[year]";
$PROP[107] = "$tag[artist]";
$PROP[108] = "$tag[album]";
$arLoadProductArray = array(
"PROPERTY_VALUES"=> $PROP
);
$ELEMENT_ID = $arFields["ID"];
$res = $el->Update($ELEMENT_ID, $arLoadProductArray);
} elseif (filesize($pathaudio) > 15000681) {
echo $die;
die();
}
}
} |