Harshith J Poojary
Harshith J Poojary

Reputation: 331

FilamentPHP: Uploaded file not saving to database and create button keeps loading

I'm currently working on a project using FilamentPHP for file uploads to an S3 bucket. I have set up a file upload field for image with various configurations like rules, disk, directory, etc. However, when I try to create a record with the uploaded file, it doesn't save to the database, and the create button keeps loading indefinitely.

Here's a code I'm using for the file upload:

FileUpload::make('image')
    ->rules(['image', 'max:1024'])
    ->nullable()
    ->image()
    ->imageEditor()
    ->placeholder('Image')
    ->disk('s3')
    ->directory('photos')
    ->visibility('private')
    ->columnSpan([
        'default' => 12,
        'md' => 12,
        'lg' => 12,
    ]),

I've checked my FilamentPHP component methods, form submission, validation errors, and database insertion logic, but I can't seem to find the issue.

Here are some additional details:

The file does get uploaded to the S3 bucket in livewire-temp, but it's not being saved to the database. There are no error messages displayed, and I've checked the logs for any exceptions, but there's nothing relevant.

enter image description here

enter image description here

Upvotes: 1

Views: 1566

Answers (1)

heruprambadi
heruprambadi

Reputation: 61

you didn't write the column name in $fillable (model)

Upvotes: 1

Related Questions