FilamentF
Filament3y ago
39 replies
Matthew

Array to string conversion:ErrorException when trying to store multiple files with FileUpload

 public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')
                    ->required()
                    ->maxLength(255),
                Textarea::make('description')
                    ->required()
                    ->maxLength(255),
                TextInput::make('amount_in_euro')
                    ->required()
                    ->label("Amount")
                    ->numeric(),
                Select::make('purchaser')
                    ->required()
                    ->label('Purchaser')
                    ->options(User::all()->pluck('name', 'id'))
                    ->searchable(),
                Select::make('status')
                    ->label('Status')
                    ->options(Status::all()->pluck('name', 'id'))
                    ->searchable(),
                DatePicker::make('date_of_purchase')
                    ->required()
                    ->displayFormat('d/m/Y'),
                FileUpload::make('attachment')
                    ->required()
                    ->multiple()
                    ->disk('public')
                    ->storeFileNamesIn('attachment_file_names')
                    ->enableDownload()
                    ->maxSize(25600)
            ]);
    }
Was this page helpful?