Skip to content

Commit a03ffa6

Browse files
committed
Some minor fixes
1 parent 831f213 commit a03ffa6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cookbook/controller/upload_file.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,26 @@ Finally, you need to update the code of the controller that handles the form::
156156
}
157157
}
158158

159+
Now, create the ``brochures_directory`` parameter that was used in the
160+
controller to specify the directory in which the brochures should be stored:
161+
162+
.. code-block:: yaml
163+
164+
# app/config/parameters.yml
165+
parameters:
166+
# ...
167+
brochures_directory: '%kernel.root_dir%/../web/uploads/brochures'
168+
159169
There are some important things to consider in the code of the above controller:
160170

161171
#. When the form is uploaded, the ``brochure`` property contains the whole PDF
162172
file contents. Since this property stores just the file name, you must set
163173
its new value before persisting the changes of the entity;
164174
#. In Symfony applications, uploaded files are objects of the
165-
:class:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile` class, which
175+
:class:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile` class. This class
166176
provides methods for the most common operations when dealing with uploaded files;
167177
#. A well-known security best practice is to never trust the input provided by
168-
users. This also applies to the files uploaded by your visitors. The ``Uploaded``
178+
users. This also applies to the files uploaded by your visitors. The ``UploadedFile``
169179
class provides methods to get the original file extension
170180
(:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getExtension`),
171181
the original file size (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientSize`)

0 commit comments

Comments
 (0)