1 file.pages.inc file_add_upload_step_filetype($form, &$form_state, array $options = array())

Generate form fields for the second step in the add file wizard.

File

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

Code

function file_add_upload_step_filetype($form, &$form_state, array $options = array()) {
  backdrop_set_title(t('Configure file type'));
  $file = file_load($form_state['storage']['upload']);
  $selected_files = $form['#options']['types'];

  $form['type'] = array(
    '#type' => 'radios',
    '#title' => t('File type'),
    '#options' => file_get_filetype_candidates($file, $selected_files),
    '#default_value' => isset($form_state['storage']['type']) ? $form_state['storage']['type'] : NULL,
    '#required' => TRUE,
  );

  $form['actions']['previous'] = array(
    '#type' => 'submit',
    '#value' => t('Previous'),
    '#limit_validation_errors' => array(),
    '#submit' => array('file_add_form_submit'),
  );
  $form['actions']['next'] = array(
    '#type' => 'submit',
    '#value' => t('Next'),
  );

  return $form;
}