title: Delete file from upload path with database table
body: <p>I done delete image url from database with following code, but is not delete file image from upload path, how can delete file from upload path with url it in database (both together)?</p>
  
  <p>This php is just for delete url from database:</p>
  
  <pre><code>$delete = $this -&gt; input -&gt; post('checked');
  foreach($delete as $val) {
      $this - &gt; db - &gt; delete($this - &gt; _table, array('id' = &gt; $val));
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I have error in use of following code.</p>
  
  <pre><code>$id = '166';
  $query = $this - &gt; db - &gt; get_where('hotel_image', array('id' = &gt; $id));
  if ($query - &gt; num_rows() &gt; 0) {
      $res = $query - &gt; row();
      unlink(base_url(uploads/$res - &gt; images));//This is line 161
  }
  $this - &gt; db - &gt; delete('hotel_image', array('id' = &gt; $id));
  </code></pre>
  
  <p>Error:(my images are in this pach: <code>http://example.com/uploads/</code>)</p>
  
  <blockquote>
    <p>A PHP Error was encountered<br> Severity: Notice<br> Message: Use of
    undefined constant uploads - assumed 'uploads'<br> Filename: user/dence.php<br> Line Number: 161<br> <p></p>
    
    <p>A PHP Error was encountered<br> Severity: Warning<br> Message:
    unlink() [function.unlink]: http does not allow unlinking<br>
    Filename: user/dence.php<br> Line Number: 161<br></p>
  </blockquote>