I offer my customers a download portal where I upload different data formats. This works fine. What is annoying, however, is that the file name is cleaned up during the upload.
Is it possible that at least upper/lower case and spaces are not converted? As only I have access to the upload as admin, can I take umlauts and special characters into consideration when assigning the name?
Unfortunately, I cannot test whether the following hook works, as the file name is already cleaned up in the selection dialogue box.
'hooks' => [
'file.create:before' => function (Kirby\Cms\File $file) {
if ($file->parent()->intendedTemplate()->name() === 'downloads') {
$filename = $file->filename();
$file->changeName(pathinfo($filename, PATHINFO_FILENAME));
}
}
],
Sorry but I don’t think this is possible. We have implemented this filename sanitation both in the frontend and backend as allowing other characters can often lead to troubles on various systems (even not on all systems).
1 Like
I think you have 2 options here:
- Manually upload the files to the server via SFTP
- Rename the files after creation using low-level file system operations i.e. not
$file->changeName()
to work around this restriction
1 Like
Thank you both for the reply and suggested solutions.
@texnixe I am using your firewall script. I use the file blueprint to assign keywords and description texts to the file. Here, I can change the displayed file name, but the file that the customer downloads is the clean version. However, I can handle this compromise. Of course, I would appreciate it if the customer could see a visually appealing file name.
Because of the additional file properties, I am reliant on uploading via the panel. In addition, the data changes frequently as it concerns layouts, quotations and other project data.
Here is a screenshot of a demo: