Skip to content

Commit

Permalink
Adding information about empty files sent using BinaryFileResponse.
Browse files Browse the repository at this point in the history
  • Loading branch information
kherge authored and weaverryan committed Oct 15, 2015
1 parent 8467240 commit aa2ac55
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 aa2ac55

Please sign in to comment.