Php Codeigniter不';不要上传视频文件

Php Codeigniter不';不要上传视频文件,php,codeigniter,Php,Codeigniter,我有一个上传视频和图像的功能问题。我可以上传图片,但不能上传视频,我不知道为什么。在和更多的控制器和窗体代码中 php用户模型中的代码: function newp($title,$post,$image,$video,$cat){ $id=$this->session->userdata('userid'); if($video!="") { $data=array( 'userid'=>$id, 'title'=>$title, '

我有一个上传视频和图像的功能问题。我可以上传图片,但不能上传视频,我不知道为什么。在和更多的控制器和窗体代码中

php用户模型中的代码:

function newp($title,$post,$image,$video,$cat){
$id=$this->session->userdata('userid');

if($video!="")

{
    $data=array(
    'userid'=>$id,
    'title'=>$title,
    'forumpost'=>$post,
    'categoryid'=>$cat,
    'videourl'=>$video
    );
}
图片:

else if($image!=""){
    $data=array(
    'userid'=>$id,
    'title'=>$title,
    'forumpost'=>$post,
    'categoryid'=>$cat,
    'imageurl'=>$image
    );
}else{
    $data=array(
    'userid'=>$id,
    'title'=>$title,
    'forumpost'=>$post,
    'categoryid'=>$cat,


    );}
   $this->db->insert('forum',$data);
  }
  }
表格:

视频部分:

if(isset($_FILES['video']) && $_FILES['video']['size']>0){
    $pktid=$this->idGenerator();

     $pathh='assets/video/';
$themepicid=$this->session->userdata('userid');
$type= pathinfo($_FILES['video']['name'], PATHINFO_EXTENSION);
$pic=$themepicid;
$themepicid=$themepicid.$pktid.".".$type;
          move_uploaded_file($_FILES['video']['tmp_name'], $pathh.$themepicid);

    $image="";
    $this->forum_model->newp($title,$post,$image,$themepicid,$cat); // How the forum likes
图像部分:

    }
else if(isset($_FILES['image']) && $_FILES['image']['size']>0){
    $pathh='assets/images/';
$themepicid=$this->session->userdata('userid');
$type= pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
    $pktid=$this->idGenerator();

$pic=$themepicid;
$themepicid=$themepicid.$pktid.".".$type;


            move_uploaded_file($_FILES['image']['tmp_name'], $pathh.$themepicid);

    $image="";
    $this->forum_model->newp($title,$post,$themepicid,$image,$cat);

}
else{

   $image="";
   $this->forum_model->newp($title,$post,$image,$image,$cat);

}


   redirect('index.php/forum','refresh');


    } 
else{

redirect('index.php/user','refresh');
    }

    }

    }

可能您的视频大小大于php.ini中的最大上传配置大小

您可以使用上载库从CI,它很容易使用,并帮助您防止错误


如果您使用CI的upload lib,请不要忘记允许配置的类型

一些疑难解答帮助会很好。当你试着发布视频时,你能把所有变量都转储掉吗?此外,这与上传文件无关,而是将它们存储在数据库中。总之,需要更多的故障排除。我添加了更多的代码,希望您现在能够理解问题所在。谢谢@PatrickI很抱歉,有很多格式错误的代码需要处理,你能指出问题本身吗?如果没有加载某个文件,请var_转储它并查看发生了什么。php.ini是服务器的配置文件我无法访问服务器上的该文件这是一个学校服务器。创建php文件并写入该文件,然后运行它,搜索常量upload_max_filesize,然后可以上载小于此大小的文件
public function newpk(){



    if($this->session->userdata('userid')){
$title=$this->security->xss_clean($this->input->post('title'));
$post=$this->security->xss_clean($this->input->post('post'));
    $cat=$this->security->xss_clean($this->input->post('cat'));

     if($cat=="" || $post=="" || $title=="")
    {
     echo "Required field cannot be empty";
    die();

     }

 $themepicid="";

    $this->load->model('forum_model');
if(isset($_FILES['video']) && $_FILES['video']['size']>0){
    $pktid=$this->idGenerator();

     $pathh='assets/video/';
$themepicid=$this->session->userdata('userid');
$type= pathinfo($_FILES['video']['name'], PATHINFO_EXTENSION);
$pic=$themepicid;
$themepicid=$themepicid.$pktid.".".$type;
          move_uploaded_file($_FILES['video']['tmp_name'], $pathh.$themepicid);

    $image="";
    $this->forum_model->newp($title,$post,$image,$themepicid,$cat); // How the forum likes
    }
else if(isset($_FILES['image']) && $_FILES['image']['size']>0){
    $pathh='assets/images/';
$themepicid=$this->session->userdata('userid');
$type= pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
    $pktid=$this->idGenerator();

$pic=$themepicid;
$themepicid=$themepicid.$pktid.".".$type;


            move_uploaded_file($_FILES['image']['tmp_name'], $pathh.$themepicid);

    $image="";
    $this->forum_model->newp($title,$post,$themepicid,$image,$cat);

}
else{

   $image="";
   $this->forum_model->newp($title,$post,$image,$image,$cat);

}


   redirect('index.php/forum','refresh');


    } 
else{

redirect('index.php/user','refresh');
    }

    }

    }