FileUpload::make()->directory('my/secret/sauce') Don't save full URL in DB
I have an existing DB, that stores just the file name for image_loc.
'user1.png' is in my DB. Now when I create a new record, image_loc = 'my/secret/sauce/filename.ext' which is how filament is saving the image location to the DB. 1.) Can I get it to just save the filename? 2.) If one is possible, What option do I need to FileUpload::make() to force it to use 'my/secret/sauce' as a path instead of just assuming it is in the database field ? Thanks,
'user1.png' is in my DB. Now when I create a new record, image_loc = 'my/secret/sauce/filename.ext' which is how filament is saving the image location to the DB. 1.) Can I get it to just save the filename? 2.) If one is possible, What option do I need to FileUpload::make() to force it to use 'my/secret/sauce' as a path instead of just assuming it is in the database field ? Thanks,
Solution:Jump to solution
Found a solution that worked for me.
Used Laravel to do this. Just created a new disk using Laravel that was the direct path I wanted. This solved all the issues I was having, no longer does the file name have the directory structure appended to it, and I don't need to change any paths....
2 Replies
If you don’t provide a ->directory() it should just be the file name. Although by default it will be a hash instead of the file name so you’d have to use the preserve file names options too.
Solution
Found a solution that worked for me.
Used Laravel to do this. Just created a new disk using Laravel that was the direct path I wanted. This solved all the issues I was having, no longer does the file name have the directory structure appended to it, and I don't need to change any paths.