php - Video uploading with Codeigniter and mysql -
i tried many ways upload videos through website. don't know why, can save images, text files etc. not possible save videos folder , database.
here view.
<form action="<?php echo base_url();?>galleries/add_vdo" method="post" enctype="multipart/form-data"> <div class="input-group"> <input type="text" class="form-control" placeholder="enter title" name="vdo_title" id="vdo_title"> <textarea class="form-control" placeholder="about video" name="vdo_desc" id="vdo_desc"></textarea> <input class="" name="ur_vdo" id="ur_vdo" type="file"> <input class="btn btn-info" type="submit" name="submit" value="add now"/> <!--<button class="btn btn-info btn-lg" id="submit" type="button">invite</button>--> </div> </form>
controller:
function add_vdo() { $data['ur_vdo'] = $this->gallery_model->add_new_vdos(); redirect('galleries/vdo_gal','refresh'); }
model :
function add_new_vdos() { $this->load->helper('date'); date_default_timezone_set('asia/calcutta'); $config['upload_path'] = './uploads/myvideos/'; $config['allowed_types'] = 'mp4|avi|flv|wmv|'; $this->load->library('upload', $config); $this->upload->initialize($config); $field_name ="ur_vdo"; $rgpic="0"; if ( !$this->upload->do_upload($field_name)) { $error = $this->upload->display_errors(); $data['error']=$error; } else { $data = $this->upload->data(); $regpicname=$data['file_name']; $rgpic="1"; } if($rgpic!=0) { $dts = array( 'familypost_caption'=>$this->input->post('vdo_title'), 'familypost_desc'=>$this->input->post('vdo_title'), 'user_id' =>$uid, 'familypost_vdo'=>$regpicname, 'familypost_status'=>'a', 'familypost_date'=>now() ); } else { $dts = array( 'familypost_caption'=>$this->input->post('vdo_title'), 'familypost_desc'=>$this->input->post('vdo_title'), 'user_id' =>$uid, 'familypost_status'=>'a', 'familypost_date'=>now() ); } $vdqr = $this->db->insert('roottildb_familyposts',$dts); }
i don't know why, video upload fails without showing error. how can solve issue?
Comments
Post a Comment