Changes
Title
unchanged
Yii v2 snippet guide II
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2,snippets
Content
changed
**Intro**
---
Hi. I had to split my article as max length was reached. Check my previous articles here (mainly the 1st one):## My articles
Articles are separated into more files as there is the max lenght for each file on wiki.
-* [
Yii v1 for beginners](https://www.yiiframework.com/wiki/25
520/yii-
v2-snippet-guidefor-beginners)
* [Yii v1 for beginners 2](https://www.yiiframework.com/wiki/
255462/yii-
for-beginners-2)
* [Yii v2
- snippet
- guide
)
- [ I](https://www.yiiframework.com/wiki/25
052/yii-
for-beginnersv2-snippet-guide)
* [Yii v2 snippet guide II](https://www.yiiframework.com/wiki/25
058/yii-
for-beginnersv2-snippet-guide-ii)
-* [
Yii v2 snippet guide III](https://www.yiiframework.com/wiki/
4622567/yii-
for-beginners-2](https://www.yiiframework.com/wiki/462/yii-for-beginners-2v2-snippet-guide-iii)
* [Začínáme s PHP frameworkem Yii2 (I) česky - YouTube](https://youtu.be/ub06hNoL8B8)
**Connection to MSSQL**[...]
```
**Sending binary data as
a file to
the browser
- decoded base64**
---[...]
// 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[...]
// https://www.yiiframework.com/doc/api/2.0/yii-web-response#sendContentAsFile()-detail
// return Yii::$app->response->send();
```
**Note:
** You can add more headers if you need. Check my previous article (linked above).
```