0

hi I am trying to upload 3gp and mp4 files on code igniter and it doesnt work

the mpg files are uploaded fine using the same code could anyone help me with that I will really appreciate that

Here is the code i am using

            $config = array(

               'allowed_types' => 'mp4|mp4|3gp|mpg';
               'file_name'     => 'video',
               'max_size'      => 1000,
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                            );

            $this->load->library('upload',$config);

            $this->upload->do_upload();


            $user_upload = $this->upload->data();
koool
  • 15,157
  • 11
  • 45
  • 60

4 Answers4

3

application/config/mimes.php

'3gp' => array(
    'video/mp4', 
    'video/3gp', 
    'video/3gpp', 
    'video/x-3gp', 
    'flv-application/octet-stream', 
    'application/octet-stream', 
    'inode/x-empty'
),
'mp4' => array(
    'video/mp4', 
    'video/3gpp',
    'application/octet-stream'
),
Renish Patel
  • 658
  • 1
  • 13
  • 14
3

Just add your mime type in the config/mimes.php file. Like for 3gp:

'3gp'=>'video/3gpp'

List of available mime types : http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

munjal
  • 1,384
  • 9
  • 15
1

add mime type for .3gp in $mimes array in below files

application/config/mimes.php

'3gp'   =>  array('video/3gpp', 'video/x-3gp', 'flv-application/octet-stream', 'application/octet-stream')
xkeshav
  • 53,360
  • 44
  • 177
  • 245
0

You have to set the allowed types of files which can be uploaded

 $config = array(
               'file_name'     => 'video',
               'max_size'      => 1000,
               'allowed_types'] = 'mp4|mp4|3gp'
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                );

and if the mime type you put in upload cofig doesn't exist in /config/mimes.php . add it there also

Vamsi Krishna B
  • 11,377
  • 15
  • 68
  • 94