title: How to download and delete a file in codeigniter
body: <p>i want to delete and download a upload file from my database 
  i already upload and show it now i want to download and delete the files which iupload
  Here is my controller showupload.php</p>
  
  <pre><code>&lt;?php class Showupload extends CI_Controller {
  
  function __construct()
  {
      parent::__construct();
      $this-&gt;load-&gt;helper(array('form', 'url'));
  }
  
  function index()
  {
  
      $this-&gt;load-&gt;model('showuploadmodel');
      $data['query']=$this-&gt;showuploadmodel-&gt;showfile(); 
      $this-&gt;load-&gt;view('showupload_view',$data);
  
  
  }
   public function delete_upload($file_id) {
      $this-&gt;load-&gt;showupload('showuploadmodel');
      $data = $this-&gt;showuploadmodel-&gt;delete($file_id);
      $this-&gt;load-&gt;view('showupload_view',$data);
  }
  public function download($filelink)
  {
  $this-&gt;load-&gt;helper('download');
  $data = file_get_contents("$filelink"); // Read the file's link
  force_download($filelink, $data);            
  }
  }
  ?&gt;
  </code></pre>
  
  <p>and this is my view show_upload_view.php</p>
  
  <pre><code>&lt;?php include_once('header.php'); ?&gt;
  &lt;?php include_once('tnavbar.php'); ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Show Upload&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
  &lt;div class='well'&gt;
  &lt;table border="0"&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;h1&gt;File Name&lt;/h1&gt;&lt;/th&gt;
      &lt;th&gt;&lt;h1&gt;Date&lt;/h1&gt;&lt;/th&gt;
      &lt;th&gt;&lt;h1&gt;Action&lt;/h1&gt;&lt;/th&gt;   
      &lt;/tr&gt;
  &lt;?php
  foreach($query as $row){
   echo "&lt;tr&gt;";
  echo "&lt;td&gt;&lt;h2&gt;". $row-&gt;filename ."&lt;/h2&gt;&lt;/td&gt;";
      echo "&lt;td&gt;&lt;h2&gt;". $row-&gt;date ."&lt;/h2&gt;&lt;/td&gt;";
      echo "&lt;td&gt;&lt;h2&gt;".Download|Delete."&lt;/h2&gt;&lt;/td&gt;";
      //now how can i make download and delete from my database
      //my database contains filename,fileid,filelink     
    echo "&lt;/tr&gt;";  
  }
  ?&gt;
  &lt;/table&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>
  now how can i make download and delete from my database
  my database contains filename,fileid,filelink</p>