Did you clear the various cache after making changes?
Sep 22, 2024
7
Level 11
Custom validation message not showing
I'm working on a form which allows multiple file uploads. Everything is working correctly, however when the file is too large I see the default Laravel validation message instead of the custom message.
#[Validate([
'photos' => 'required',
'photos.*' => 'mimes:jpg,png,gif|max:12288',
],
message:[
'photos.*.mimes' => 'You can only upload JPGs, PNGs, and GIFs',
'photos.*.max' => 'Images cannot be larger than 12MB'
]
)]
public $photos = [];
I see this default error message: The image must not be greater than 12288 kilobytes, instead of my custom message: Images cannot be larger than 12MB.
When updating my value to 10240 I still see Livewire is validating for 12MB, instead of my 10, so are my rules being ignored?
This is what I have in config/livewire.php
'temporary_file_upload' => [
'disk' => null,
'rules' => ['file', 'mimes:jpg,png,gif', 'max:12288'],
'directory' => null,
'middleware' => null,
'preview_mimes' => ['png', 'gif', 'jpg', 'jpeg'],
'max_upload_time' => 5,
],
Please or to participate in this conversation.