Hi,
I am working on a site with lots of front-end file uploads, and have hit some difficulties with filenames causing issues in the panel. For example, if a user uploads this file:
blank & something {{} [].pdf
It gets saved to the content folder as:
blank & something {{} [].pdf
Then when the client clicks on this in the Kirby panel there is the error message “The view could not be found”
I am now trying to use Str::slug
to fix this (there may be a better way), so I can convert the filename to something better. However, when I do this it is also applying to the extension, so the file now looks like:
blank-amp-something-pdf
Which is no good.
What is the best way of sanitizing the filenames, while keeping the extension? Is it possible to get Str::slug
to ignore ‘.’ characters?
Any help gratefully appreciated!