Custom validation message for File-upload
I am trying to provide custom validation messages for the acceptedFileTypes to prevent uploading invalid formats. I want to restrict the invalid file upload while uploading the file itself hence I am not using rules method. But it is not taking the custom message that I am giving, rather it is taking the default messages provided by filament.
Can anyone help me regarding this? Below is the code that I am using
->acceptedFileTypes(['image/jpeg','image/jpg'])
->label('File')
->required()
->maxSize(5120)
->default(asset('public/images/VehiclesMngt.jpeg'))
->validationMessages([
'acceptedFileTypes'=>'Please upload only jpeg or jpg images', 'maxSize' => 'The uploaded file cannot be larger than 5mb' ]),
->validationMessages([
'acceptedFileTypes'=>'Please upload only jpeg or jpg images', 'maxSize' => 'The uploaded file cannot be larger than 5mb' ]),
1 Reply