title: Calling a controller method from view
body: <p>I have a method in my controller </p>
  
  <pre><code>public function download($filepath){
  
  $download_path = $_SERVER['DOCUMENT_ROOT']. "mediabox/import";
  $file = $download_path + $filepath ;
  
  if(!$file) die("I'm sorry, you must specify a file name to download.");
  if(eregi("\.ht.+", $file)) die("I'm sorry, you may not download that file.");
  if(!file_exists($file)) die("I'm sorry, the file doesn't seem to exist.");
  $type = filetype($file);
  
      header("Content-type: $type");
  header("Content-Disposition: attachment;filename=$filename");
  header('Pragma: no-cache');
  header('Expires: 0');
      // Send the file contents.
  readfile($file);
  
  }
  </code></pre>
  
  <p>In my view I have a link </p>
  
  <pre><code>&lt;a target='_blank' class='download_dialog' onClick="???"&gt;
  </code></pre>
  
  <p>I want to call the download metho of my controller onclick event of the link .
  Is it good to do so ?
  How can I do it ?
  Thanks</p>