This site is not supported for Internet Explorer 6. It might look funny or even not function properly if you are using this browser.
You upgrade Flash as soon as they get a new version. Why not get an updated browser?
Try Firefox, Chrome or if you love and breath Microsoft than IE7.

Upload custom file in user registration process - Drupal 6

Adding a file upload field to user profile form - Drupal 6

Even though many are using Drupal 7 now I recently had to come up with a way to add a custom file upload field to a user profile form. Though content profile would be the preferred way to do this the client needed to keep using the core profile module. hook_form_alter was the obvious route to go. Here is what I did:

Basically you can base the code off the picture upload in user.module and create a custom module for your form_alter:

function myModule_form_alter(&$form,&$form_state, $form_id) {
  $form['#attributes'] = array('enctype' => 'multipart/form-data');
  $form['profile_custom_file'] = array(
    '#type' => 'file',
    '#title' => t('Upload File'),
    '#size' => 48,
    '#required' => FALSE,
    '#description' => t("Upload your file here")
  );
 
  if ($form_id == 'user_profile_form'):
    //Get current file if it exists
    $original_file = unserialize($form['_account']["#value"]->data);
    $original_file = $original_file['profile_custom_file'];
    //Show the current file
    if (!empty($original_file)):
      $org = explode("/",$original_file);
      $org = array_pop($org);
      $form['profile_custom_file_delete'] = array('#type' => 'checkbox', '#title' => t('Delete File'), '#description' => t('Check this box to delete your current file.  Currently uploaded as '.$org));
    else:
      $form['profile_custom_file_delete'] = array('#type' => 'hidden');
    endif;    
  endif;
  $form['#validate'][] = 'myModule_validate_form';
}

The above code simply adds a field using basic Forms API calls. The defining pieces for a file upload is the #attributes and the #validate. In order to upload a file you must specify the form's enctype of "multipart/form-data". The validation is where we do our processing and saving.

There is also some code in there for when the user edits his profile to allow for deleting.

The validate function is below:

function myModule_validate_form(&$form, &$form_state) {
  $original_file = unserialize($form['_account']["#value"]->data);
  $original_file = $original_fiile['profile_license_file'];
 
  //We setup some validation
  $validators = array(
    'file_validate_extensions' =>  array('doc docx pdf'),
    'file_validate_size' => array(variable_get('image_max_upload_size', '3072') * 1024),
  );
 
  //Delete if user wants to
  if (($form_state['values']['profile_custom_file_delete']) === 1) {
    if ($original_file && file_exists($original_file)) {
      file_delete($original_file);
    }
  }
  if ($file = file_save_upload('profile_custom_file', $validators)) {
     // Remove the old file
    if (isset($form_state['values']['_account']->profile_custom_file) && file_exists($form_state['values']['_account']->profile_custom_file)) {
      file_delete($form_state['values']['_account']->profile_custom_file);
    }
    $ext = pathinfo($file->filename, PATHINFO_EXTENSION);
 
    //Save to destination
    $destination = variable_get('user_picture_path', 'sites/default/files') .'/file--'.time().'.'. $ext;
    if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
      $form_state['values']['profile_custom_file'] = $file->filepath;
    }
    else {
      form_set_error('profile_custom_file', t("Failed to upload the custom file; the %directory directory doesn't exist or is not writable.", array('%directory' => variable_get('user_picture_path', 'sites/default/files'))));
    }
  } //file_save_upload
}

Heading through that we simply get the original filename and delete the file if the user chooses too. Then we save the file. Hopefully this helps.