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)