© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
rubendn

FileUpload Previewing with File Name not based on Stored Field

I'm uploading an image using the FileUpload component using the following code where the image name is not stored in one of the database fields and it is stored in the public directory directly.
                Forms\Components\FileUpload::make('player_image')
                    ->disk('public')
                    ->directory('front/images/player_photos')
                    ->label('Player Image')
                    ->dehydrated(false)
                    ->getUploadedFileNameForStorageUsing(static fn (?Model $record) => $record->PlayerID . '.jpg'),
                Forms\Components\FileUpload::make('player_image')
                    ->disk('public')
                    ->directory('front/images/player_photos')
                    ->label('Player Image')
                    ->dehydrated(false)
                    ->getUploadedFileNameForStorageUsing(static fn (?Model $record) => $record->PlayerID . '.jpg'),


This uploads the image correctly into the public folder. Is there a way I can get it to preview the image in the filepond component when I go back into the form to edit the record?

This is the config for the public disk:

    'disks' => [
        'public' => [
            'driver' => 'local',
            'root' => public_path('/'),
            'url' => env('APP_URL').'/',
            'visibility' => 'public',
            'throw' => false,
        ],
    ],
    'disks' => [
        'public' => [
            'driver' => 'local',
            'root' => public_path('/'),
            'url' => env('APP_URL').'/',
            'visibility' => 'public',
            'throw' => false,
        ],
    ],


Thank you.
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

FileUpload.. Change file name on display?
FilamentFFilament / ❓┊help
3y ago
FileUpload file saved with encrypted name, preview with original name
FilamentFFilament / ❓┊help
3y ago