用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2523|回复: 3
收起左侧

为什么用ci的框架上传flv文件类型的文件总是报错

[复制链接]
发表于 2012-11-6 11:09:49 | 显示全部楼层 |阅读模式
这是我的代码//添加课件
public function addMovieOk()
{
  
    $config['upload_path']         = './upload/movie/';   //上传文件到什么目录中
          $config['allowed_types']     = 'flv';
          $config['max_size']          = '1000000';
   
         $config['file_name']         = date('YmdHis');
         
         $this->load->library('upload', $config);
   $fullName=$_FILES["sources"]['name'];
   $ext=explode('.',$fullName);
   $url='./upload/movie/'.$config['file_name'].'.flv';
  // var_dump($this->upload->do_upload('sources'));
  // exit();
    if($this->upload->do_upload('sources'))
          {
  $data = array(
      'c_id'       =>  $_POST['c_id'],
               'moviename'  =>  $this->input->post('sourcename'),
      'intro'      =>  $_POST['content'],
      'author'     =>  $this->session->userdata('username'),
      'url'        =>  $url,
      'dateline'   =>  time(),
            );
  $this->db->insert('ed_movie', $data);
  $this->db->Get_admin_msg("movieManage","添加成功");
  }else{
  $error = array('error' => $this->upload->display_errors());
   
   $this->load->view('upload_form', $error);
  
  }
}为什么上传flv的文件总是报错说文件的类型是不允许的,上传失败?
 楼主| 发表于 2012-11-6 11:10:55 | 显示全部楼层
我这里已经设置了可以上传的文件类型是flv 但是上传之后打印error 还是报错。说文件的类型是不允许的。
 楼主| 发表于 2012-11-6 11:11:09 | 显示全部楼层
求大神帮忙
发表于 2014-3-22 01:35:09 | 显示全部楼层
你的flv类型没有配置 数据类型
application/config/mimes.php 文件配置列表里 加上这句就ok了

'flv'   =>  array('flv-application/octet-stream','application/octet-stream'),

本版积分规则