You are here

function biblio_import_form_validate in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio.import.export.inc \biblio_import_form_validate()
  2. 7 includes/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

./biblio.import.export.inc, line 151
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 = $form_state['values']['filetype'];
  if ($error = $_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 == "none") {
    form_set_error('biblio_import_form', t("Error: You must select a file type"));
  }
}