Ejemplo n.º 1
0
 public function actionUploadfont()
 {
     $model = new UploadForm();
     $font = new Fonts();
     if (Yii::$app->request->isPost) {
         $model->file = UploadedFile::getInstance($model, 'file');
         if ($model->validate()) {
             if ($model->file->saveAs('../../Ontee/web/css/fonts/' . $model->file->baseName . '.' . $model->file->extension)) {
                 $font->ttfurl = 'css/fonts/' . $model->file->baseName . '.' . $model->file->extension;
                 $font->name = $model->file->baseName;
                 $font->save();
                 return $this->redirect(Url::to(['site/fonts']));
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function actionFonts()
 {
     $fonts = Fonts::find()->all();
     return $this->render('font', ['fonts' => $fonts]);
 }