Hm, Kirby 2 had an option to prevent filename sanitization. Doesn’t seem to be possible in Kirby 3, though, at least I can’t find anything.
You could store the original filename in the session with a file.create:before
hook (the $upload
parameter contains the (hashed) original filename) and then retrieve this name in the file.create:after
hook.
'hooks' => [
'file.create:before' => function($file, $upload) {
$filename = $upload->filename();
$filename = substr($filename, strpos($filename, ".") + 1);
kirby()->session()->set('ofilename', $filename);
},
'file.create:after' => function($file) {
$filename = kirby()->session()->get('ofilename');
$file->update([
'originalname' => $filename,
]);
}
]