I want to upload image inside my news model, but when I try to create a news item the CI say:

```
INSERT INTO `news` (`title`, `slug`, `text`, `featured_image`) VALUES ('sample title', 'sample-title', 'upload image into db', NULL)

```

My function in controller is:

```
public function create()
    {
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');

        // start config image upload
        $config['upload_path'] = './assets/uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_width'] = 1024;
        $config['max_height'] = 768;
        $this->load->library('upload', $config);
        // end

        $data['title'] = 'Create a news item';

        $this->form_validation->set_rules('title', 'Title', 'required');
        $this->form_validation->set_rules('text', 'Text', 'required');

        if ($this->form_validation->run() === FALSE)
        {
            $this->load->view('templates/header', $data);
            $this->load->view('news/create');
            $this->load->view('templates/footer');

        }
        else
        {

            $data = array('upload_data' => $this->upload->data());
            $this->news_model->set_news();

            $this->load->view('templates/header');
            $this->load->view('news/success');
            $this->load->view('templates/footer');          
        }
    }

```

Also, my model is:

```
 public function set_news($id = 0)
    {
        $this->load->helper('url');

        $slug = url_title($this->input->post('title'), 'dash', TRUE);

        $data = array(
            'title' => $this->input->post('title'),
            'slug' => $slug,
            'text' => $this->input->post('text'),
            'featured_image' => $this->input->post('featured_image')
        );

        if ($id == 0) {
            return $this->db->insert('news', $data);
        } else {
            $this->db->where('id', $id);
            return $this->db->update('news', $data);
        }
    }

```

And my view **views/news/create.php**

```
<h2><?php echo $title; ?></h2>
<hr>
<?php echo validation_errors(); ?>

<?php echo form_open_multipart('news/create'); ?>

    <div class="row">
        <div class="six-columns">
            <label for="title">Title</label>
            <input class="u-full-width" type="text" name="title"><br />

            <label for="text">Text</label>
            <textarea class="u-full-width" name="text"></textarea><br />

            <label for="image">Featured image</label>
            <input class="u-full-width" type="file" name="featured_image" /><br />

            <input class="button-primary" type="submit" name="submit" value="Create news item" />
        </div>
    </div>
</form>

```

I can not find a tutorial that explains how to store the picture string in the database, my table name is **news** and column name is **featured\_image**