If you want to upload a file with CodeIgniter you should read my old post about it first.
Config Arguments
So, if you want to be able to upload mp4 files you have to tweak it a little bit.
When you setup the config arguments, add the allowed type and the max size.
$config['allowed_types'] = 'gif|jpg|png|mp4';
$config['max_size'] = '1000000000000000'; // whatever you need
Code language: PHP (php)
Add the mime type mp4 to CodeIgniter
Go to:
/application/config/mimes.php
And add the following value to the $mime array.
'mp4' => 'video/mp4',
Code language: PHP (php)
Now you should be able to upload a mp4 video through a form input ๐
Cesar
Really useful, exactly solves ‘my problem’.
Thanks dude.
Rick
Glad it worked ! ๐
Matias Fabian Lecaros Aranis
hi, any idea on how to establish as a requirement the max duration(time) length for a video?, I’m guessing something like $config[‘max_length’] >< thx
Rick
Hi there Matias,
I don’t think that’s posible.
CI should be able to read the video file (wich it might require a server side video library).
However, if you happen to find the answer feel free to post it here. I’d appreciate it ๐
Cheers.
Ketav
It works fine..
Thanks ๐
Rick
You’re welcome!
altaf
not upload mp4 vedio
Rick
Yeah the code is 7 years old, maybe it’s no longer valid with newer CodeIgniter version.
Aniket
Can you upload new version Code
Ricard Torres
I’m afraid not, Aniket. I has been years since I last played with CodeIgniter.
If you happen to find an updated version, feel free to post it as a comment!
Thank you
mahdi
Hello, what should I do when the file is uploaded but not displayed?
Ricard Torres
Hard to tell.