Hi!
I’m trying to rename files on upload (Site name + page title + number) but unfortunately this doesn’t work
Maybe someone has any good tips?
'hooks' => [
'file.create:after' => function ($file) {
$page = $file->page();
$title = $page->title();
$count = $page->files()->count() + 1;
$filename = "Something-" . $title . "-" . $count;
try {
$file->rename($filename);
} catch(Exception $e) {
}
}
(It’s the latest Kirby build.)
Thanks!