@@ -156,14 +156,14 @@ There are some important things to consider in the code of the above controller:
156
156
provides methods for the most common operations when dealing with uploaded files.
157
157
#. A well-known security best practice is to never trust the input provided by
158
158
users. This also applies to the files uploaded by your visitors. The ``Uploaded ``
159
- class provides methods to get the original file extension (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getExtension() `),
160
- the original file size (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getSize() `)
161
- and the original file name (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getClientOriginalName() `).
159
+ class provides methods to get the original file extension (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getExtension `),
160
+ the original file size (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getSize `)
161
+ and the original file name (:method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::getClientOriginalName `).
162
162
However, they are considered *not safe * because a malicious user could tamper
163
163
that information. That's why it's always better to generate a unique name and
164
- use the :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::guessExtension() `
164
+ use the :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::guessExtension `
165
165
method to let Symfony guess the right extension according to the file MIME type.
166
- #. The ``UploadedFile `` class also provides a :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::move() `
166
+ #. The ``UploadedFile `` class also provides a :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::move `
167
167
method to store the file in its intended directory. Defining this directory
168
168
path as an application configuration option is considered a good practice that
169
169
simplifies the code: ``$this->container->getParameter('brochures_dir') ``.
@@ -172,6 +172,6 @@ You can now use the following code to link to the PDF brochure of an product:
172
172
173
173
.. code-block :: html+jinja
174
174
175
- <a href="{{ asset('uploads/brochures' ~ product.brochure) }}">View brochure (PDF)</a>
175
+ <a href="{{ asset('uploads/brochures/ ' ~ product.brochure) }}">View brochure (PDF)</a>
176
176
177
177
.. _`VichUploaderBundle` : https://github.com/dustin10/VichUploaderBundle
0 commit comments