Difference between #50 and #51 of
Yii v2 snippet guide II

Revision #51 has been created by rackycz on Oct 11, 2020, 5:35:57 PM with the memo:

base64 stream download
« previous (#50) next (#52) »

Changes

Title unchanged

Yii v2 snippet guide II

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2,snippets

Content changed

[...]
Yii::$app->response->headers->set('Content-Type', 'application/pdf');

// This row will download the file. If you do not use the line, the file will be displayed in the browser.
// Details here:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#Downloads
//
 Yii::$app->response->headers->set('Content-Disposition','attachment; filename="hello.pdf"');

// Here is used the temporary stream
Yii::$app->response->stream = $stream;

// You can call following line, but you don't have to. Method send() is called automatically when current action ends:
[...]
4 0
3 followers
Viewed: 75 529 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Aug 26, 2020
Last updated: 3 years ago
Update Article

Revisions

View all history