Changed function generating names for uploaded files to the server.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>File name</th>
|
||||
<th class="text-end">File size</th>
|
||||
<th>Extension</th>
|
||||
@@ -16,7 +15,6 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="file in files">
|
||||
<td>{{ file.id }}</td>
|
||||
<td>{{ file.fileName }}
|
||||
<p class="mb-0" v-if="file.book">
|
||||
<a class="text-decoration-none" :href="'/book/'+file.book.id">{{
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user