Skip to content

Commit

Permalink
feature symfony#5345 Adding information about empty files sent using …
Browse files Browse the repository at this point in the history
…BinaryFileResponse. (kherge)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes symfony#5345).

Discussion
----------

Adding information about empty files sent using BinaryFileResponse.

Updating documentation to account for weird scenario described in symfony#5268.

Commits
-------

aa2ac55 Adding information about empty files sent using BinaryFileResponse.
  • Loading branch information
weaverryan committed Oct 15, 2015
2 parents 8467240 + aa2ac55 commit cbd91b4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/http_foundation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,20 @@ You can still set the ``Content-Type`` of the sent file, or change its ``Content
'filename.txt'
);

.. versionadded:: 2.6
The ``deleteFileAfterSend()`` method was introduced in Symfony 2.6.

It is possible to delete the file after the request is sent with the
:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method.
Please note that this will not work when the ``X-Sendfile`` header is set.

.. note::

If you *just* created the file during this same request, the file *may* be sent
without any content. This may be due to cached file stats that return zero for
the size of the file. To fix this issue, call ``clearstatcache(false, $file)``
with the path to the binary file.

.. _component-http-foundation-json-response:

Creating a JSON Response
Expand Down

0 comments on commit cbd91b4

Please sign in to comment.