Skip to content

Add a caution to the getUploadRootDir Doctrine #5287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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