Filament 3 - One Form Two FileUpload not working
Hello, I created a form using Filament version 3, where I want to use two file upload components, but unfortunately, it doesn’t work as expected. The goal is to create two separate folders ('property/' . $get('property_code') . '/images' and 'property/' . $get('property_code') . '/plans'), but this setup doesn’t work. The images folder is correctly created inside the property_code folder, but the plans folder is not.
Why is the property_code only created for one of them? Also, for the images field, there are no preview images, only for the plans field, even though the path is correct.
No preview image is displayed here. http://localhost:8000/storage/property/6nlTVcCBqP/images/01JHBM2XJ4YNKX0J3MKHMD6YZZ.jpg
A preview image is displayed here. http://localhost:8000/storage/property//plans/01JHBM2XJFNA5XZ9YRDK14PY7P.jpg
Forms\Components\TextInput::make('property_code')
->label(__('fields.property_code'))
->default( Str::random(length: 15))
->disabled()
->dehydrated()
->maxLength(15)
->unique(Property::class, 'property_code', ignoreRecord: true),
Forms\Components\FileUpload::make('images')
->label(__('fields.property_list_plans'))
->image()
->imagePreviewHeight('200')
->panelLayout('grid')
->multiple()
->reorderable()
->openable()
->directory(fn (callable $get) => 'property/' . $get('property_code') . '/images')
->downloadable(),
Forms\Components\FileUpload::make('plans')
->label(__('fields.property_list_plans'))
->image()
->imagePreviewHeight('200')
->panelLayout('grid')
->multiple()
->reorderable()
->openable()
->directory(fn (callable $get) => 'property/' . $get('property_code') . '/plans')
->downloadable(),
Please or to participate in this conversation.