Reputation: 163
I want to upload video file in mysql database
my controller coding
function add_videochk()
{
$this->load->helper('url');
$this->load->library('session');
$this->load->model("add_db");
$map=$_FILES['map']['name'];
$filename=$this->input->post('map');
if(is_uploaded_file($_FILES['map']['tmp_name']))
{
$filename = $_FILES['map']['name'];
//$config['upload_path'] = './assets/video/';
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'mp4|3gp|gif|jpg|png|jpeg|pdf';
$config['max_size']='';
$config['max_width']='200000000';
$config['max_height']='1000000000000';
// $config['image_library']='gd2';
$this->load->library('upload', $config);
$img = $this->upload->do_upload('map');
}
$data["result"] = $this->add_db->addnewvideo($map);
redirect('user/add_video','refresh');
}
when i upload image file it upload success in database and uplaods folder but when i upload video file its upload only database not in folder
so i want to upload video file in database and its folder
please help...
Upvotes: 1
Views: 9985
Reputation: 5506
Check for the post and upload file sizes first
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M`
Then inside the config/mimes.php
add the missing file type you are going to uplaod, something like bellow.
'mpeg' => array('video/mpeg', 'video/quicktime'),
'mpg' => array('video/mpeg', 'video/quicktime'),
'mp4' => array('video/mp4', 'video/quicktime'),
'mpe' => array('video/mpeg', 'video/quicktime'),
'qt' => 'video/quicktime',
'mov' => array('video/quicktime', 'video/mp4'),
'avi' => array('video/avi', 'video/x-msvideo'),
Upvotes: 2