Filament V3 not working with s3 and image column

I have made an image column that I am uploading to s3. The upload works when I am initially creating a form, I can see the image in s3. But when I go to save the resource, the column fails with validation "The school Logo field must be a file of type: image/*". This is despite successfully saving it to s3. I am uploading a png. Here is the form and table column.
Tables\Columns\ImageColumn::make('path')
->disk('s3')
->width(100)
->height(100)
->label('Logo')
->visibility('public')
Tables\Columns\ImageColumn::make('path')
->disk('s3')
->width(100)
->height(100)
->label('Logo')
->visibility('public')
Forms\Components\FileUpload::make('path')
->label("School Logo")
->disk('s3')
->visibility('public')
->image()
Forms\Components\FileUpload::make('path')
->label("School Logo")
->disk('s3')
->visibility('public')
->image()
Solution:
found my issue. i had overwritten the file-upload.blade.php but seems this file has changed in a new version of filament
Jump to solution
6 Replies
Wiebe
Wiebe6d ago
@Akimbo i've got the same issue. did you find a solution yet?
Dennis Koch
Dennis Koch6d ago
Did you guys make sure, that path is cast to array?
Wiebe
Wiebe6d ago
FileUpload::make('image')
->label(__('manage.image'))
->inlineLabel()
->hiddenLabel()
->image()
->maxSize('6000')
->disk('s3')
->visibility('public')
->hint($hint)
->rules(['mimes:png,jpg,jpeg,gif'])
->directory($organisation->id.'-'.$organisation->original_slug.'/media/'.$directory)
->imageEditorViewportWidth('1600')
->imageEditorViewportHeight('900')
->imageResizeTargetWidth('1600')
->imageResizeTargetHeight('900')
->imageResizeMode('cover')
->imageEditor()
->imageEditorAspectRatios([
'16:9', '21:9'
]),
FileUpload::make('image')
->label(__('manage.image'))
->inlineLabel()
->hiddenLabel()
->image()
->maxSize('6000')
->disk('s3')
->visibility('public')
->hint($hint)
->rules(['mimes:png,jpg,jpeg,gif'])
->directory($organisation->id.'-'.$organisation->original_slug.'/media/'.$directory)
->imageEditorViewportWidth('1600')
->imageEditorViewportHeight('900')
->imageResizeTargetWidth('1600')
->imageResizeTargetHeight('900')
->imageResizeMode('cover')
->imageEditor()
->imageEditorAspectRatios([
'16:9', '21:9'
]),
it worked fine before updating to laravel 12 without ->image() it works fine
Dennis Koch
Dennis Koch6d ago
So it sounds like something with Filesystem or the validation has changed?
Wiebe
Wiebe6d ago
looks like a frontend issue, when modifiing the acceptedfiletypes function it works:
public function acceptedFileTypes(array | Arrayable | Closure $types): static
{
// $this->acceptedFileTypes = $types;

$this->rule(static function (BaseFileUpload $component) {
$types = implode(',', ($component->getAcceptedFileTypes() ?? []));

return "mimetypes:image/*";
});

return $this;
}
public function acceptedFileTypes(array | Arrayable | Closure $types): static
{
// $this->acceptedFileTypes = $types;

$this->rule(static function (BaseFileUpload $component) {
$types = implode(',', ($component->getAcceptedFileTypes() ?? []));

return "mimetypes:image/*";
});

return $this;
}
backend validation works then
Solution
Wiebe
Wiebe6d ago
found my issue. i had overwritten the file-upload.blade.php but seems this file has changed in a new version of filament

Did you find this page helpful?