This CodeLet adds a field on Drupal registration form and allows the user to upload an avatar. This will be saved to user's picuture field on his/her profile. This will work only if 'Picutre' is enabled by the admin.

User profile upload | Drupal Developer
CodeLet
<?php//$Id$/** * @file *  * Allow a user to upload a file or image from the user's profile page *   * @author DrupalD <DrupalD@twitter>  *//** * Implementation of hook_user * @param $op * @param $edit * @param $account * @param $category * @author DrupalD <DrupalD@twitter> */function user_upload_user($op, &$edit, &$account, $category = NULL) {    switch ($op) {    case 'register':    case 'form':        $form['user_picture'] = array(          '#type' => 'file',          '#title' => t("Your Avtar"),         );         return $form;    case 'insert':        $account->picture_upload = $edit['user_picture'];        break;    }}?>
DrupalD
Enroll to Drupal 10 Training