preserveFilenames() not working with SpatieMediaLibraryFileUpload
Hi, I'm using the
SpatieMediaLibraryFileUpload
in a Form Builder. The docs say: "You may use the field in the same way as the original file upload field", however I can't get preserveFilenames()
to work. The uploaded files are always renamed - the instruction seems to get ignored completely. Is there anything I'm missing?9 Replies
Try placing it at the end of the field definition
No luck, it was already at the end.
Not sure whether that method works on with SpatieFileUpload since Spatie handles the upload and storage and not Filament
I might be wrong, but I don't think the Spatie Media Library is renaming files by default. It seems like it is the standard filament behaviour and
preserveFilenames()
is just not working.Question.. is this is the download or the storage?
I am using this perfectly well:
I was referring to the filename in storage, I'm not using
->downloadable()
. So with this config, the files won't be renamed on the storage in your environment?Where are you storing it? That stores correctly in storage for me.
I tested different disks, but the result is always the same. I also tried using the documented method for custom names and then just returning the original name in it, but this also doesn't change anything:
I also tried using the default
FileUpload
field instead and it doesn't work there either. I also found someone else with the same problem, so at least I'm not alone 😅 https://github.com/filamentphp/filament/issues/12368GitHub
Error when calling preserveFilenames function in Class Forms\Compon...
Package filament/filament Package Version 3.1.31 Laravel Version 10.48.8 Livewire Version No response PHP Version 8.1 Problem description Error when calling preserveFilenames function in Class Form...