© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
sven

Using SpatieMediaLibraryFileUpload in form tabs

When I try to add the SpatieMediaLibraryFileUpload form component to a Filament\Forms\Components\Tabs\Tab component I get the following error: "Filament\Forms\Components\SpatieMediaLibraryFileUpload::Filament\Forms\Components{closure}(): Argument #2 ($file) must be of type string, array given".

Can anyone help me with this?

Here is the full code I'm trying to implement:

Tabs::make('Media')
  ->tabs([
      Tabs\Tab::make('Upload')
          ->schema([
              SpatieMediaLibraryFileUpload::make('media')
                  ->label('')
                  ->openable()
                  ->preserveFilenames()
                  ->imageEditor()
                  ->customProperties(['caption' => 'my caption'])
                  ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string {
                      return str($file->getClientOriginalName())->prepend(now()->timestamp);
                  })
                  ->multiple()
                  ->panelLayout('grid')
                  ->reorderable()
          ]),
      Tabs\Tab::make('Meta')
          ->schema([
              Repeater::make('media')
                  ->relationship()
                  ->schema([
                      TextInput::make('custom_properties.caption'),
                      KeyValue::make('custom_properties'),
                      ViewField::make('file_name')
                          ->label('File')
                          ->view('filament.forms.components.media')
                  ]),
          ]),
      ])
Tabs::make('Media')
  ->tabs([
      Tabs\Tab::make('Upload')
          ->schema([
              SpatieMediaLibraryFileUpload::make('media')
                  ->label('')
                  ->openable()
                  ->preserveFilenames()
                  ->imageEditor()
                  ->customProperties(['caption' => 'my caption'])
                  ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string {
                      return str($file->getClientOriginalName())->prepend(now()->timestamp);
                  })
                  ->multiple()
                  ->panelLayout('grid')
                  ->reorderable()
          ]),
      Tabs\Tab::make('Meta')
          ->schema([
              Repeater::make('media')
                  ->relationship()
                  ->schema([
                      TextInput::make('custom_properties.caption'),
                      KeyValue::make('custom_properties'),
                      ViewField::make('file_name')
                          ->label('File')
                          ->view('filament.forms.components.media')
                  ]),
          ]),
      ])
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

Form Tabs
FilamentFFilament / ❓┊help
3y ago
Save button in tabs form
FilamentFFilament / ❓┊help
3y ago
Tabs Form error
FilamentFFilament / ❓┊help
2y ago
Using tabs not repeater for dynamic form
FilamentFFilament / ❓┊help
17mo ago