Skip to content

Commit

Permalink
address concretecms#83: show informative error msg when adding conten…
Browse files Browse the repository at this point in the history
…t to batch
  • Loading branch information
shahroq committed Jan 30, 2020
1 parent c108e45 commit bcf9504
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,17 @@ 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 = new \Symfony\Component\HttpFoundation\File\UploadedFile(
$_FILES['file']['tmp_name'],
$_FILES['file']['name'],
$_FILES['file']['type'],
$_FILES['file']['size'],
$_FILES['file']['error'],
true
);

if (!$UploadedFile->isValid()) {
$this->error->add($UploadedFile->getErrorMessage());
} else {
$importer->validateUploadedFile($_FILES['file'], $this->error);
}
Expand Down

0 comments on commit bcf9504

Please sign in to comment.