Пример #1
0
 /**
  * Letöltésre kényszeríti a megadott fájlt.
  * @param int $id A fájl azonosítója
  */
 public function actionDownload($id)
 {
     $id = (int) $id;
     $model = File::model()->findByPk($id);
     if ($model == null) {
         throw new CHttpException(404, "A kért elem nem található");
     }
     $model->downloads++;
     $model->save();
     $Req = new CHttpRequest();
     $Req->sendFile($model->filename_real, file_get_contents("upload/" . $model->filename_local));
 }