From 3615f416e346ff788facfd9e960fd3058bceda28 Mon Sep 17 00:00:00 2001 From: Ishan Jayamanne Date: Tue, 26 Mar 2019 01:28:36 +0000 Subject: [PATCH] Fix exception error message fails when error in upload file. --- code/Control/UserDefinedFormController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/Control/UserDefinedFormController.php b/code/Control/UserDefinedFormController.php index d4001ed..5dc5de3 100644 --- a/code/Control/UserDefinedFormController.php +++ b/code/Control/UserDefinedFormController.php @@ -252,7 +252,9 @@ JS $upload->loadIntoFile($_FILES[$field->Name], $file, $foldername); } catch (ValidationException $e) { $validationResult = $e->getResult(); - $form->addErrorMessage($field->Name, $validationResult->message(), 'bad'); + foreach ($validationResult->getMessages() as $message) { + $form->sessionMessage($message['message'], ValidationResult::TYPE_ERROR); + } Controller::curr()->redirectBack(); return; }