Codeigniter: MP4 Video Upload not working Codeigniter: MP4 Video Upload not working codeigniter codeigniter

Codeigniter: MP4 Video Upload not working


Finally I got solution of my Problem so I am writing this answer.

Mostly detection of mime types in local and online server are different.

In my case, Local server was getting file_type as "video/mp4". But online server was detecting the mime type as 'application/octet-stream'.

So I added both in array in the mime type list in my config folder:

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

Now it works perfectly in both local and online server.


If everything doesn't work, rearrange the allowed type order like this, placing the video format first:

$config['allowed_types'] = 'mp4|jpg|png|'

It works in my case.


I depend on video mime file types when we upload video with extension mp4 but in CodeIgniter upload library use php function finfo_file for detect file_type by this function we get other file_type. Ex. I get video/3gpp

So I changed in config/mimes.php

'mp4' => array('video/mp4', 'video/3gpp'),

and its working for me.

Thanks