为什么用ci的框架上传flv文件类型的文件总是报错
这是我的代码//添加课件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的文件总是报错说文件的类型是不允许的,上传失败?
我这里已经设置了可以上传的文件类型是flv 但是上传之后打印error 还是报错。说文件的类型是不允许的。 求大神帮忙 你的flv类型没有配置 数据类型
application/config/mimes.php 文件配置列表里 加上这句就ok了
'flv' =>array('flv-application/octet-stream','application/octet-stream'),
页:
[1]