Search code examples
phpcodeignitervideofile-uploadupload

Codeigniter: MP4 Video Upload not working


I am researching on a problem for long time but still could not find any solution.

I am uploading mp4 file using codeigniter. Before that I added mime type for mp4 in config/mimes.php. I tried both: mp4 => video/mp4 and mp4 => array('video/mp4', 'video/3gpp')

Both of these works perfect in Local server but whenever I test this on the Live server then It always give the same error message "The filetype you are attempting to upload is not allowed.".

I tried one more thing. i.e. $config['allowed_types'] = "*";

It works perfect in both local and online server.

But I want just mp4 video type.

Anybody have some solution for this strange problem?


Solution

  • 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.