1 file.pages.inc file_manage_form_validate($form, &$form_state)

Form validation handler for file_manage_form().

File

core/modules/file/file.pages.inc, line 652
Supports file operations including Manage and Delete.

Code

function file_manage_form_validate($form, &$form_state) {
  // Validate the "associated user" field.
  if (!empty($form_state['values']['name']) && !($account = user_load_by_name($form_state['values']['name']))) {
    // The use of empty() is mandatory in the context of usernames
    // as the empty string denotes the anonymous user. In case we
    // are dealing with an anonymous user we set the user ID to 0.
    form_set_error('name', t('The username %name does not exist.', array('%name' => $form_state['values']['name'])));
  }

  // Run entity form validation.
  entity_form_field_validate('file', $form, $form_state);
}