Skip to content

Commit

Permalink
Merge pull request #86 from shahroq/feature/show-informative-error-ms…
Browse files Browse the repository at this point in the history
…g-when-adding-content-to-batch

address #83: show informative error msg when adding content to batch
  • Loading branch information
aembler authored Feb 14, 2020
2 parents 95f1d84 + e47e400 commit f3e23da
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,11 @@ public function add_content_to_batch()

$importer = \Core::make('migration/manager/importer/parser')->driver($this->request->request('format'));

if (!is_uploaded_file($_FILES['file']['tmp_name'])) {
$this->error->add(t('Invalid XML file.'));
$uploadedFile = $this->request->files->get('file');
if ($uploadedFile === null) {
$this->error->add(t('File not uploaded'));
} elseif (!$uploadedFile->isValid()) {
$this->error->add($uploadedFile->getErrorMessage());
} else {
$importer->validateUploadedFile($_FILES['file'], $this->error);
}
Expand Down

0 comments on commit f3e23da

Please sign in to comment.