Yii: How to manage videos when using multiuploadfiles extension

微笑、不失礼 提交于 2019-12-02 13:19:25

If you don't save the model in database, first check if data from submit are what you need and the model is saved without model validation.

public function actionCreate()
{
    $model=new Video;

    // Uncomment the following line if AJAX validation is needed
    // $this->performAjaxValidation($model);
    if(isset($_POST){
      var_dump('ALL POST');
      var_dump($_POST);
    } else {
      var_dump('NO POST'); 
    }

    if(isset($_POST['video']))
    { 
        var_dump('VIDEO POST');
        var_dump($_POST['video']);

        $model->attributes=$_POST['video'];
        //$model->video = Video::getInstance($model, 'video');
        if($model->save(false))
            $this->redirect(array('view','id'=>$model->id));
    }

    $this->render('create',array(
    'model'=>$model,
    ));
}

If the var_dump show proper value and overriding the validation the value is saved in db the problem is in the validation rules.

and in the view try

<?php 

     echo "<br /> Video = : ".  $model->video  ."<br />";
?>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!