2 added 257 characters in body
source | link

I assume you are not setting you default_value for the file field and that you are using a managed_file field.

The default value should be the fid of the file that has been uploaded before.

Something like this:

$form['profile_image'] = array(
  '#title' => t('Profile picture'),
  '#type' => 'managed_file',
  '#description' => t('Upload a photo for your profile.'),
  '#default_value' => $previously_uploaded_file->fid,
);

In your case I'm not exactly sure where the $previously_uploaded_file->fid will come from, but I assume it will be in your form or form state or else you will have to get it from the database or something.

If you are using a regular file field instead of a managed_file file field I don't believe you can set a default value.

In that case you have to make sure that when you do the user save that you are not overwriting the file with an empty value.

I assume you are not setting you default_value for the file field and that you are using a managed_file field.

The default value should be the fid of the file that has been uploaded before.

Something like this:

$form['profile_image'] = array(
  '#title' => t('Profile picture'),
  '#type' => 'managed_file',
  '#description' => t('Upload a photo for your profile.'),
  '#default_value' => $previously_uploaded_file->fid,
);

In your case I'm not exactly sure where the $previously_uploaded_file->fid will come from, but I assume it will be in your form or form state or else you will have to get it from the database or something.

I assume you are not setting you default_value for the file field and that you are using a managed_file field.

The default value should be the fid of the file that has been uploaded before.

Something like this:

$form['profile_image'] = array(
  '#title' => t('Profile picture'),
  '#type' => 'managed_file',
  '#description' => t('Upload a photo for your profile.'),
  '#default_value' => $previously_uploaded_file->fid,
);

In your case I'm not exactly sure where the $previously_uploaded_file->fid will come from, but I assume it will be in your form or form state or else you will have to get it from the database or something.

If you are using a regular file field instead of a managed_file file field I don't believe you can set a default value.

In that case you have to make sure that when you do the user save that you are not overwriting the file with an empty value.

1
source | link

I assume you are not setting you default_value for the file field and that you are using a managed_file field.

The default value should be the fid of the file that has been uploaded before.

Something like this:

$form['profile_image'] = array(
  '#title' => t('Profile picture'),
  '#type' => 'managed_file',
  '#description' => t('Upload a photo for your profile.'),
  '#default_value' => $previously_uploaded_file->fid,
);

In your case I'm not exactly sure where the $previously_uploaded_file->fid will come from, but I assume it will be in your form or form state or else you will have to get it from the database or something.