Yii: How to manage videos when using multiuploadfiles extension

后端 未结 1 1052
独厮守ぢ
独厮守ぢ 2021-01-29 09:04

I am a yiibie and i am working on uploading of video. I have used the uploadmultifile extension and have made changes according to this link http://www.yiifra

相关标签:
1条回答
  • 2021-01-29 09:07

    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 />";
    ?>
    
    0 讨论(0)
提交回复
热议问题