First, make sure that you don't pass the filename directly to your controller, because it becomes part of the url.
The link in your view should be like this:
PHP Code:
echo anchor('download/download_file/' . urlencode($filename),$filename);
//the anchor function is in the url helper
Now, in the controller method, I decode the given filename.
PHP Code:
public function download_file($name)
{
//$name is the encoded filename, passed by the view
$this->load->helper('download');
$path = './uploads/docs/' . urldecode($name);
if (file_exists($path)) {
force_download($path,NULL);
}
else {
show_error('File not found!');
die();
}
}
Let me know if this helps.