[英]issue with uploading mp4 video file even after changing the mime type to 'mp4' => video/mp4 and giving file type as mp4
I am trying to upload a mp4 video file using codeigniter file upload class as follows, 我正在尝试使用codeigniter文件上传类上传mp4视频文件,如下所示:
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. mimes.php'mp4'=>'video / mp4'中给出的mime类型,我还增加了php.ini中的文件大小post_upload_max size
和upload_max_filesize
到足够的水平。
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
". 但是,当我尝试上传扩展名为.mp4的大小为8 MB的示例视频文件时,显示错误为“ 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)
在print_r($_FILES)
上获取它
在mime.php中为MP4设置MIME类型
'mp4' => array('video/mp4', 'application/octet-stream'),
I removed 我删除了
$config['mimes'] = 'mp4';
from my controller and it is working properly. 从我的控制器上,它可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.