Skip to content

Instantly share code, notes, and snippets.

@VSeryoga
Created August 16, 2016 07:25
Show Gist options
  • Save VSeryoga/8c53aff71e5b8f62afbe7d7f6f04cab8 to your computer and use it in GitHub Desktop.
Save VSeryoga/8c53aff71e5b8f62afbe7d7f6f04cab8 to your computer and use it in GitHub Desktop.
Bitrix user edit (photo)
<?if($_POST["fullname"] != ""){
if($_FILES["photo"]["name"]){ /// если новое фото подгружено
$dir_upl = $_SERVER['DOCUMENT_ROOT']."/upload/";
if (is_uploaded_file($_FILES[photo][tmp_name])){
move_uploaded_file($_FILES[photo][tmp_name], $dir_upl.$_FILES[photo][name]);
}else{
echo 'Упс... Картинка не загрузилась';
}
$arFile = CFile::MakeFileArray($dir_upl.$_FILES[photo][name]);
$arFile['del'] = "Y";
$arFile['old_file'] = $arUser['PERSONAL_PHOTO'];
}
$name = explode(" ", $_POST["fullname"]);
$fields = array(
"NAME" => $name[0],
"LAST_NAME" => $name[1],
"PERSONAL_PHONE" => $_POST["phone"],
"EMAIL" => $_POST["email"],
"PERSONAL_ZIP" => $_POST["zip"],
"PERSONAL_CITY" => $_POST["city"],
"PERSONAL_STREET" => $_POST["address"],
"PERSONAL_PHOTO" => $arFile
);
}
$user = new CUser;
$user->Update($USER->GetID(), $fields);
$strError .= $user->LAST_ERROR;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment