[eluser]Computerzworld[/eluser]
Hello. I am using CI download helper for downloading the file from the server. What I want is to download the file by clicking on the download link. I have written the code like for downloading the file like this in my controller.
Code:
function forceDownload()
{
$this->load->helper('download');
$data = file_get_contents(base_url().'/uploads/files/admin_uploadedFile'); // Read the file's contents
$name = $this->fileName;
force_download($name, $data);
}
and I am calling this function on click event of download link. In js I am using redirection to go to this function.
But instead of download it redirects me to the folder on the server where all files are located. I got stuck at this point. Please help me. Thanks in advance.