In my page , I have created one form with different fields like name, email,password,etc., Now I have to upload the image and store in my database. Any one send the code with all fields including image upload file. I have to try in many times, image can't upload in my database.
My controller is
function activity() {
$this->load->library('form_validation');
//field name,error message, validation rules
$this->form_validation->set_rules('activityid', 'Activity Id', 'trim|required');
$this->form_validation->set_rules('hostid', 'Host Id', 'trim|required');
$this->form_validation->set_rules('activityname', 'Activity Name', 'trim|required');
$this->form_validation->set_rules('date', 'Date', 'trim|required');
$this->form_validation->set_rules('venue', 'Venue', 'trim|required');
$this->form_validation->set_rules('typeofactivity', 'Type of Activity', 'trim|required');
$this->form_validation->set_rules('conductedby', 'Conducted By', 'trim|required');
if ($this->form_validation->run() == FALSE) {
//$this->load->view('signup_form');
$this->activity_reg();
} else {
$this->load->model('membership_model');
$query = $this->membership_model->activity();
if ($query) {
$data['main_content'] = 'signup_successful';
$this->load->view('includes/templates', $data);
} else {
$this->load->view('activity');
}
}
}
My model is
function activity() {
$new_member_insert_data = array(
'activityid' => $this->input->post('activityid'),
'hostid' => $this->input->post('hostid'),
'activityname' => $this->input->post('activityname'),
'date' => $this->input->post('date'),
'venue' => $this->input->post('venue'),
'typeofactivity' => $this->input->post('typeofactivity'),
'conductedby' => $this->input->post('conductedby')
);
$this->load->database();
$insert = $this->db->insert('activity', $new_member_insert_data);
return $insert;
}