Changed function generating names for uploaded files to the server.

This commit is contained in:
krzysiej
2022-06-09 11:09:51 +02:00
parent ccef18a2ca
commit 61ab01f297
2 changed files with 7 additions and 5 deletions

View File

@@ -45,9 +45,13 @@ class FileService
public function getFileName(File $file): string
{
return 'ebook_' . $file->getBook()->getId() . '_' .
md5($file->getFileName()) . '.' .
$file->getExtension();
return sprintf(
'ebook_%d_%d_%s.%s',
$file->getBook()->getId(),
$file->getId(),
md5($file->getFileName()),
$file->getExtension()
);
}
/**