public function sendFile($field = null, $name = null)
    {
        if (!$name && (!$name = $this->getFirstFileName())) {
            return false;
        }
        $file = $this->getFilePath($field, $name);
        if (!$name || !file_exists($file)) {
            throw new NotFoundHttpException;
        }
        \Yii::$app->response->sendFile($file, $name);
    }
public function sendFile($field = null, $name = null)
    {
        if (!$name && (!$name = $this->getFirstFileName())) {
            return false;
        }
        $file = $this->getFilePath($field, $name);
        if (!$name || !file_exists($file)) {
            throw new NotFoundHttpException;
        }
        \Yii::$app->response->sendFile($file, $name);
    }
public function sendFile ( $ field = null , $ name = null ) { if ( ! $ name && ( ! $ name = $ this -> getFirstFileName ( ) ) ) { return false ; } $ file = $ this -> getFilePath ( $ field , $ name ) ; if ( ! $ name || ! file_exists ( $ file ) ) { throw new NotFoundHttpException ; } \ Yii :: $ app -> response -> sendFile ( $ file , $ name ) ; }
Sends file to user download.
@param null $field
@param null $name
@return bool
@throws NotFoundHttpException
Sends file to user download .