© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
LancelotGamer

How can I hydrate FileUpload field with a URL

I tried this code but it didn't work

Forms\Components\FileUpload::make('image')
->afterStateHydrated(
    function (FileUpload $component, Closure $get) {
        if ($get('image_id')) {
            $image = Image::find($get('image_id'))->with('storageLocation')->first();
            $component->state([$image->storageLocation->host_name . '/' . $image->file_path]);
        }
    }
),
Forms\Components\FileUpload::make('image')
->afterStateHydrated(
    function (FileUpload $component, Closure $get) {
        if ($get('image_id')) {
            $image = Image::find($get('image_id'))->with('storageLocation')->first();
            $component->state([$image->storageLocation->host_name . '/' . $image->file_path]);
        }
    }
),


The image dose show in the table
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

How can I ->fill() a FileUpload field?
FilamentFFilament / ❓┊help
3y ago
FileUpload with url
FilamentFFilament / ❓┊help
3y ago
change fileupload field preview url
FilamentFFilament / ❓┊help
2y ago
Fileupload field
FilamentFFilament / ❓┊help
2y ago