Skip to content

Commit

Permalink
Adding a caution to the getUploadRootDir() method
Browse files Browse the repository at this point in the history
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | symfony#4177 [Doctrine] Security issue in handling file uploads with Doctrine
  • Loading branch information
Ana Cicconi committed May 23, 2015
1 parent 12ed2e6 commit 69475d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cookbook/doctrine/file_uploads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ file.
If you're using annotations to specify your validation rules (as shown
in this example), be sure that you've enabled validation by annotation
(see :ref:`validation configuration <book-validation-configuration>`).

.. caution::

If you use the getUploadRootDir() method, be aware that this will save
the file inside the document root, which can be accessed by everyone.
Consider placing it out of the document root and adding custom viewing
logic when you need to secure the files.

To handle the actual file upload in the form, use a "virtual" ``file`` field.
For example, if you're building your form directly in a controller, it might
Expand Down

0 comments on commit 69475d0

Please sign in to comment.