© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Wim

FileUpload with dynamic folder name

I'm using Filament to upload product images. I would like to create a folder structure as follows:
/images/product1/image1.png, /images/product1/image2.png ....  /images/productN/image1.png, /images/productN/imageN.png. 
/images/product1/image1.png, /images/product1/image2.png ....  /images/productN/image1.png, /images/productN/imageN.png. 
Hence I would like to use the product name (product1...productN) in the ->directory() method. Anyone could provide an example on how to do this?
Solution
Assuming you have a 'slug' field you can do
->directory(fn ($get) => $get('slug'))
->directory(fn ($get) => $get('slug'))
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

FileUpload dynamic directory issue
FilamentFFilament / ❓┊help
10mo ago
Dynamic directory for FileUpload
FilamentFFilament / ❓┊help
3y ago
FileUpload file saved with encrypted name, preview with original name
FilamentFFilament / ❓┊help
3y ago
Closure Upload Folder dynamic
FilamentFFilament / ❓┊help
2y ago