Skip to content

Commit 49b2b79

Browse files
authored
Merge pull request #1340 from bcit-ci/downloaddocs
Update docs for downloads to reflect the need to return it. Fixes #1331
2 parents bfcadc3 + 9c89ebb commit 49b2b79

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

user_guide_src/source/outgoing/response.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,16 @@ Example::
9292

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

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

100100
// Contents of photo.jpg will be automatically read
101-
$response->download('/path/to/photo.jpg', NULL);
101+
return $response->download('/path/to/photo.jpg', NULL);
102+
103+
.. note:: The response object MUST be returned for the download to be sent to the client. This allows the response
104+
to be passed through all **after** filters before being sent to the client.
102105

103106
HTTP Caching
104107
============

0 commit comments

Comments
 (0)