doupao2277 2014-02-18 06:26
浏览 277
已采纳

即使将mime类型更改为'mp4'=> video / mp4并将文件类型设置为mp4,也可以上传mp4视频文件

I am trying to upload a mp4 video file using codeigniter file upload class as follows,

function do_upload_video()
{
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'mp4';
    $config['mimes'] = 'mp4';
    $config['max_size'] = '1000000';

    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());
        $data['main_content'] ='admin/elements/add_video';
        $this->load->view('includes/template', $data);

    }
    else
    {
        $chapter_id=$this->session->userdata('chapter_id');
        redirect("/admin/elements/".$chapter_id);
    }
}

mime type given in mimes.php 'mp4' => 'video/mp4' further, I have also increased the file size in php.ini post_upload_max size and upload_max_filesize to sufficient level.

However when i am trying to upload a sample video file of size 8 MB with .mp4 extension it is showing error as "The filetype you are attempting to upload is not allowed".

Array ( [video] => Array ( [name] => daddyshome_paLrcx9H.mp4            [type]=>video/mp4 [tmp_name] => /tmp/php3xrVFp [error] => 0 [size] => 7350845 ) ) 

getting this on print_r($_FILES)

  • 写回答

2条回答 默认 最新

  • drplww2505 2014-02-19 07:06
    关注

    I removed

          $config['mimes'] = 'mp4';
    

    from my controller and it is working properly.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划