You are here

function media_add_upload_validate in D7 Media 7

Validate the generic file upload with the global media settings.

File

includes/media.pages.inc, line 203
Common pages for the Media module.

Code

function media_add_upload_validate($form, &$form_state) {

  // Save the file as a temporary file.
  $file = file_save_upload('upload', $form['#validators']);
  if ($file === NULL) {
    form_set_error('upload', t("No file appears to have been selected."));
  }
  elseif ($file === FALSE) {
    form_set_error('upload', t('File upload error.'));
  }
  else {
    $form_state['values']['upload'] = $file;
  }
}