© 2026 Hedgehog Software, LLC

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

Data type for FileUpload

I have simple Page, generated with
php artisan make:filament-page
php artisan make:filament-page

In there I have a Form with multiple components, one of them being FileUpload (for uploading image).

The property I want to use to store the image name is $quote_1_image. In databases this column is a string.
public ?string $quote_1_image;

public function mount(): void
{
    $this->homePage = \App\Models\Pages\HomePage::find(1);
    $this->form->fill($this->homePage->toArray());
}

public function form(Form $form): Form
{
    return $form->schema([
        Forms\Components\FileUpload::make('quote_1_image')
            ->image(),
...
public ?string $quote_1_image;

public function mount(): void
{
    $this->homePage = \App\Models\Pages\HomePage::find(1);
    $this->form->fill($this->homePage->toArray());
}

public function form(Form $form): Form
{
    return $form->schema([
        Forms\Components\FileUpload::make('quote_1_image')
            ->image(),
...


I'm however getting this error:
Cannot assign array to property App\Filament\Pages\HomePage::$quote_1_image of type ?string
Cannot assign array to property App\Filament\Pages\HomePage::$quote_1_image of type ?string


When I change the datatype to array, the error says:
Cannot assign string to property App\Filament\Pages\HomePage::$quote_1_image of type ?array
Cannot assign string to property App\Filament\Pages\HomePage::$quote_1_image of type ?array
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 base64 data
FilamentFFilament / ❓┊help
3y ago
Queue FileUpload(s) for large data (videos/images)
FilamentFFilament / ❓┊help
3y ago
Need help for fileupload
FilamentFFilament / ❓┊help
13mo ago
FileUpload for Cloudflare Images
FilamentFFilament / ❓┊help
2y ago