© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Srccode

Custom Validation Rule not showing failure message in File upload field.

Hello all. I was trying to make a custom validation rule for a file upload field, but this was returned instead of the correct error message:
Illuminate\Validation\ClosureValidationRule
Illuminate\Validation\ClosureValidationRule
. So i thought of making a rule class but when I do that the path of the rule is returned instead. Below is my code for the file upload field:

 Forms\Components\FileUpload::make('data')
                    ->required()
                    ->maxSize(128000)
                    ->rules([new DataValidationRule()])
                    ->hidden(function (Get $get) {
                        $type = $get('type');
                        return $type === TypeEnum::WITH_WEIGHTS->value;
                    }),
 Forms\Components\FileUpload::make('data')
                    ->required()
                    ->maxSize(128000)
                    ->rules([new DataValidationRule()])
                    ->hidden(function (Get $get) {
                        $type = $get('type');
                        return $type === TypeEnum::WITH_WEIGHTS->value;
                    }),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom validation message for File-upload
FilamentFFilament / ❓┊help
2y ago
Validation message is not showing
FilamentFFilament / ❓┊help
16mo ago
Custom validation in custom field
FilamentFFilament / ❓┊help
2y ago
Custom validation message?
FilamentFFilament / ❓┊help
3y ago