Skip to content

Commit

Permalink
Merge pull request #1340 from bcit-ci/downloaddocs
Browse files Browse the repository at this point in the history
Update docs for downloads to reflect the need to return it. Fixes #1331
  • Loading branch information
lonnieezell authored Oct 24, 2018
2 parents bfcadc3 + 9c89ebb commit 49b2b79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions user_guide_src/source/outgoing/response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,16 @@ Example::

$data = 'Here is some text!';
$name = 'mytext.txt';
$response->download($name, $data);
return $response->download($name, $data);

If you want to download an existing file from your server you'll need to
do the following::

// Contents of photo.jpg will be automatically read
$response->download('/path/to/photo.jpg', NULL);
return $response->download('/path/to/photo.jpg', NULL);

.. note:: The response object MUST be returned for the download to be sent to the client. This allows the response
to be passed through all **after** filters before being sent to the client.

HTTP Caching
============
Expand Down

0 comments on commit 49b2b79

Please sign in to comment.