ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentโ€ข2y agoโ€ข
15 replies
Davide Cariola

Using a FileUpload input in a Custom Page

Hello everyone!

I have created a custom page with several forms, all of which work perfectly, except for one.

What doesn't work is a form with two FileUploads, one for an article cover, the other for multiple other images.

Doing a
dd
dd
of the
getState()
getState()
I get this result, but honestly I was expecting an instance of FileUploaded (or whatever it's called), whereas now it's just returning strings.

Is this normal? On the page I called the
WithFileUploads
WithFileUploads
trait.

My code so far:
protected function getForms(): array
{
    return [
        'imagesForm',
        'webArticleForm',
        'briefFormWithEditing',
        'briefFormWithoutEditing',
        'webArticleLinkoutForm'
    ];
}
protected function getForms(): array
{
    return [
        'imagesForm',
        'webArticleForm',
        'briefFormWithEditing',
        'briefFormWithoutEditing',
        'webArticleLinkoutForm'
    ];
}


public function imagesForm(Form $form): Form
{
return $form
    ->schema([
        Section::make(Str::title('Cover Image'))
            ->schema([
                FileUpload::make('cover')
                    ->label('')
                    ->image()
                    ->imageEditor(),
                    // ->required(),
                TextInput::make('cover_alt_text'),
                    // ->required(),
                TextInput::make('cover_credits_text')
                    // ->required(),
            ]),
        Section::make('Other Images')
            ->schema([
                FileUpload::make('other_images')
                    ->label('')
                    ->multiple()
                    ->maxFiles(10)
                    ->image()
                    ->imageEditor()
                    ->panelLayout('grid'),
            ]),
    ])
    ->statePath('imagesData');
}
public function imagesForm(Form $form): Form
{
return $form
    ->schema([
        Section::make(Str::title('Cover Image'))
            ->schema([
                FileUpload::make('cover')
                    ->label('')
                    ->image()
                    ->imageEditor(),
                    // ->required(),
                TextInput::make('cover_alt_text'),
                    // ->required(),
                TextInput::make('cover_credits_text')
                    // ->required(),
            ]),
        Section::make('Other Images')
            ->schema([
                FileUpload::make('other_images')
                    ->label('')
                    ->multiple()
                    ->maxFiles(10)
                    ->image()
                    ->imageEditor()
                    ->panelLayout('grid'),
            ]),
    ])
    ->statePath('imagesData');
}


dd($this->imagesForm->getState());
dd($this->imagesForm->getState());


Thanks everyone!
image.png
image.png
Solution
Ok, found the problem ๐Ÿ˜„

I had to use the
imagesData
imagesData
array, and not the
getState()
getState()
method.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel โ€ข Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Using filters in a custom page
FilamentFFilament / โ“โ”Šhelp
2y ago
handle input value in a custom Page view
FilamentFFilament / โ“โ”Šhelp
12mo ago
Fileupload in Single record editing with custom page
FilamentFFilament / โ“โ”Šhelp
13mo ago
Set custom headers using FileUpload
FilamentFFilament / โ“โ”Šhelp
2mo ago