title: CodeIgniter - Uploading an Image through a form, store the location of the image in database
body: <p>I'm trying to upload an image to my site through a form, however it's much more efficient to (rather than bog down the database) just store the location of the image in the database.</p>
  
  <p>I'm having trouble with my form and really don't know where to go:</p>
  
  <pre><code>&lt;?=form_open('bro/submit_new');?&gt;
   //other form data
   Image: &lt;input type="file" name="image" size="20" /&gt; &lt;br&gt;
   &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now the form itself works fine, the problem is that it's trying to store the image into the database field 'image' (which is type TEXT).  What's the easiest way to tell it to just store the file, and give the file location to store in the 'image' field? (I tell it where to upload the file via the controller).</p>
  
  <p>Thanks</p>
  
  <p>Edit: controller code (for this part):</p>
  
  <pre><code>function submit_new(){
      $config['upload_path'] = './images/';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size'] = '2000';
      $config['max_width']  = '1024';
      $config['max_height']  = '768';     
      $this-&gt;load-&gt;library('upload', $config);
  
      $this-&gt;db-&gt;insert('post', $_POST);
  
      redirect('bro');
  }
  </code></pre>