i did not get image upload and save image path in database
My table name is uploadimage and controller name is upload.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upload extends CI_Controller {
public function index()
{
$this->load->view('view');
}
public function do_upload()
{
$status="";
$msg="";
$filename='product_pic';
if(empty($_POST['title']))
{
$status="error";
$msg="plz enter title";
}
if($status!="error")
{
$config['upolad_path']='./file/';
$config['allowed_types']='gip|jpg|png';
$config['max_size']=1024*0;
$config['encrypt_name']=true;
$this->load->library('upload',$config);
if(!$this->upload->do_upload($filename))
{
$status='error';
$msg=$this->upload->display_errors('','');
}
else
{
$this->load->model('file_model');
$data=$this->upload->data();
$file_id=$this->file_model->insert_file($data['file_name'],$_POST['title']);
if($file_id)
{
redirect('Upload/view');
}
}
}