Why did you change `'application/octet-stream'` to `'text/plain'` here?
Also you need to use Filehelper as it was used  before, there is no CFileHelper in yii2 ;)