for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace yiicod\fileupload\models\traits;
use Yii;
/**
* Coco trait uploader
*
* @author Orlov Alexey <[email protected]>
*/
trait FileDownloadTrait
{
* Download
* @param $fileName
* @param $filePath
public static function download(string $fileName, string $filePath)
if (file_exists($filePath)) {
Yii::$app->response->sendFile($filePath, $fileName);
}