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 of the 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 trait.

My code so far:
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');
}


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


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

I had to use the imagesData array, and not the getState() method.
Was this page helpful?