Custom URL and file path on FIleUpload

Hi, I have basic FileUpload component for handling image uploads:
FileUpload::make('featured_image')
->disk('images')
->preserveFilenames()
->visibility('private')
->directory('instance_xxx')
FileUpload::make('featured_image')
->disk('images')
->preserveFilenames()
->visibility('private')
->directory('instance_xxx')
I want to achieve two things: 1. Now files are stored in "images" disk in /instance_xxx/ directory. Under featured_image in my database filament stores "/instance_xxx/abc.jpg" as a value. Is there a way to make it store only filename without path? I've tried to overwrite it in ->mutateDehydratedStateUsing() component, and i can do it this way but after this FIleUpload component thumbnail show there is no image (not even broken URL or something, just like there was null on "featured_image") 2. How to change URL of image that is displyed as FIleUpload thumbnail? The thing is, that my app is on multiple domains, and images are located on few subdomains, on completely different path. They are cached and converted to webp on the fly by img-proxy etc. In my app i have simple method to generating url for images, how can i apply it as FIleUpload thumbnail? Thanks
1 Reply
Iranzi Dev
Iranzi Dev14mo ago
Why when uploading failed then return file null
Want results from more Discord servers?
Add your server