Displaying files attached to a book.
This commit is contained in:
@@ -44,7 +44,6 @@ class BookController extends AbstractController
|
|||||||
|
|
||||||
$ebook = $request->files->get('book')['ebook'];
|
$ebook = $request->files->get('book')['ebook'];
|
||||||
if ($ebook) {
|
if ($ebook) {
|
||||||
dd($ebook);
|
|
||||||
$ebook->move(
|
$ebook->move(
|
||||||
$this->getParameter('book_files'),
|
$this->getParameter('book_files'),
|
||||||
'ebook_' . $book->getId() . '.' . $ebook->guessClientExtension()
|
'ebook_' . $book->getId() . '.' . $ebook->guessClientExtension()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for book in books %}
|
{% for book in books %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% if file_exists(asset('book_covers/cover_' ~ book.id ~ '.jpg')) %}<img class="img-thumbnail" src="{{ asset('book_covers/cover_' ~ book.id ~ '.jpg' ) }}" /> {% endif %}</td>
|
<td>{% if file_exists(asset('book_covers/cover_' ~ book.id ~ '.jpg')) %}<img class="img-thumbnail" style="max-width: 80px" src="{{ asset('book_covers/cover_' ~ book.id ~ '.jpg' ) }}" /> {% endif %}</td>
|
||||||
<td>{{ book.id }}</td>
|
<td>{{ book.id }}</td>
|
||||||
<td>{{ book.Title }}</td>
|
<td>{{ book.Title }}</td>
|
||||||
<td>{{ book.language }}</td>
|
<td>{{ book.language }}</td>
|
||||||
|
|||||||
@@ -34,6 +34,34 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>File name</th>
|
||||||
|
<th>File size</th>
|
||||||
|
<th>Extension</th>
|
||||||
|
<th>Download</th>
|
||||||
|
<th>Remove</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for file in book.files %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ file.id }}</td>
|
||||||
|
<td>{{ file.fileName }}</td>
|
||||||
|
<td>{{ file.fileSize }}</td>
|
||||||
|
<td>{{ file.extension }}</td>
|
||||||
|
<td>download</td>
|
||||||
|
<td>remove</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">no files found</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
<a href="{{ path('app_book_index') }}">back to list</a>
|
<a href="{{ path('app_book_index') }}">back to list</a>
|
||||||
|
|
||||||
<a href="{{ path('app_book_edit', {'id': book.id}) }}">edit</a>
|
<a href="{{ path('app_book_edit', {'id': book.id}) }}">edit</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user