You are here

function biblio_import_form_validate in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.import.export.inc \biblio_import_form_validate()
  2. 6 biblio.import.export.inc \biblio_import_form_validate()
  3. 7.2 includes/biblio.import.export.inc \biblio_import_form_validate()

Implementation of hook_validate() for the biblio_import_form.

File

includes/biblio.import.export.inc, line 194
Functions that are used to import and export biblio data.

Code

function biblio_import_form_validate($form, &$form_state) {
  $op = $form_state['values']['op'];
  $filetype = isset($form_state['values']['filetype']) ? $form_state['values']['filetype'] : 0;
  if ($error = isset($_FILES['files']) ? $_FILES['files']['error']['biblio_import_file'] : '') {
    switch ($error) {
      case 1:
        form_set_error('biblio_import_form', t("The uploaded file exceeds the upload_max_filesize directive in php.ini."));
        break;
      case 2:
        form_set_error('biblio_import_form', t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."));
        break;
      case 3:
        form_set_error('biblio_import_form', t("The uploaded file was only partially uploaded."));
        break;
      case 4:
        form_set_error('biblio_import_form', t("No file was uploaded."));
        break;
      case 6:
        form_set_error('biblio_import_form', t("Missing a temporary folder."));
        break;
      case 7:
        form_set_error('biblio_import_form', t("Failed to write file to disk."));
        break;
      case 8:
        form_set_error('biblio_import_form', t("File upload stopped by extension."));
    }
  }
  if ($op == t('Import') && $filetype == "0") {
    form_set_error('biblio_import_form', t("You did not select the file type"));
  }
}