- Issue created by @piotrkonefal
- Assigned to PrabuEla
- Issue was unassigned.
When the filesize reaches the max_upload_filesize
value, there is no validation error displayed. There is a missing piece either in core or a webform module. AJAX error defined in docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
is not being displayed at all when AJAX is enabled on webform. Instead the error is displayed in browser console.
max_upload_filesize
to 120 MBThe messenger error coming from core should be displayed on the webform.
// Render a nice error message in case we have a file upload which exceeds
// the configured upload limit.
if ($exception instanceof BrokenPostRequestException && $request->query->has(FormBuilderInterface::AJAX_FORM_REQUEST)) {
$this->messenger->addError($this->t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', [
'@size' => ByteSizeMarkup::create((int) $exception->getSize()),
]));
$response = new AjaxResponse(NULL, 200);
$status_messages = ['#type' => 'status_messages'];
$response->addCommand(new PrependCommand(NULL, $status_messages));
$event->allowCustomResponseCode();
$event->setResponse($response);
return;
}
Source: docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
Active
6.2
Code