title: image uploading issue in codeigniter 2.1.0
body: <p>i am using CI 2.1.0 and mysql database for one of my projects. i am facing a problem with my image uploading method. the image i am uploading should be saved in uploads directory and create a thumbnail version of the image and the image path should be saved in database.
  the code i have done works fine but there is one problem that when i upload an image, in the upload directory i get two copies of the same image and in the thumbs directory a single copy of the uploaded image. i want to have only one copy of the image instead of those two copies .
  here is my code-><br/></p>
  
  <p>model:</p>
  
  <pre><code>function do_upload() //to upload images in upload directory
          {
              $i=$this-&gt;db-&gt;get('portfolio')-&gt;num_rows();
              $i=$i+1;
              $image_path=realpath(APPPATH . '../uploads');
              $config=array(
                  'allowed_types'=&gt;'jpeg|png|gif|jpg',
                  'upload_path'=&gt;$image_path,
                  'max_size'=&gt;2097152,
                  'file_name'=&gt;'_'.$i.'_'
              );
              $this-&gt;load-&gt;library('upload', $config);
              $this-&gt;upload-&gt;do_upload();
              $image_data = $this-&gt;upload-&gt;data();
              $config=array(
                  'source_image'=&gt;$image_data['full_path'],
                  'new_image'=&gt;$image_path.'/thumbs',
                  'maintain_ration'=&gt;TRUE,
                  'width'=&gt;150,
                  'height'=&gt;100
              );
              $this-&gt;load-&gt;library('image_lib', $config);
              $this-&gt;image_lib-&gt;resize();
              if( ! $this-&gt;upload-&gt;do_upload())
              {
                  $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
                  return $error;
              }
              else
              {
                  return $image_data;
              }
          }
  </code></pre>
  
  <p><br/>some please tell me why two copies of images are being uploaded.
  there is anothe thing, i want images to be overwritten if an image with same name exists. i have changed the <code>upload.php</code> file inside <code>system-&gt;libraries</code> to this</p>
  
  <pre><code>public $overwrite               = TRUE;
  </code></pre>
  
  <p>but it is not working. someone please help.</p>