In CodeIgniter, we can easily make files for download. There is a helper class called download, which we are using for downloading files from server. We just need a controller function and a view file.
Copy and modify the below code in controller.
public function download_file ($file_path = "")
$this->load->helper('download'); //load helper class
//$file_path = $this->input->post("file_path",TRUE);
$data['download_path'] = $file_path;
redirect("same url", "refresh");
In view file:
$data = file_get_contents(base_url() ."/path/".$download_path); // Read the file's contents
$name = $download_path;
Now you can download files from your server easily. Enjoy coding with Code Igniter.