Reputation: 33
I have added in mime file:
'mp4' => array('video/mp4', 'video/3gpp'),
still not able to upload files. Not showing any errors also.
Any idea how to upload all types of files in codeigniter through form
Upvotes: 1
Views: 1875
Reputation: 1961
Make sure you are doing the right thing by checking the extension and the file type as well! For instance, if your file name is video.mp4, your file type is probably video/mp4 but not necessarily! (I was just dealing with a .m4a file and my audio type is audio/mp4.)
You can test the correct file type by printing it out for yourself after an upload.
echo $_FILES[0]['file_type'];
After that, you can add the following line to the mimes.php config file:
$mimes['<your extension>'] = '<your file type>';
Alternatively, if you encounter multiple MIME types for the same extension, you can add an array instead:
$mimes['<your extension>'] = array('<your file type 1>', '<your file type 2>');
I hope this helps!
Upvotes: 0
Reputation: 6339
Hi just add your mime type to application/config/mimes
'mp4' =>'video/mp4'
'3gp'=>'video/3gpp'
then just add each one individually in the allowed types
Upvotes: 3