codeigniter upload 3gp or mp4 files doesnt work
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
开发者_如何学Go $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();
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
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'
),
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')
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
精彩评论