[eluser]elaniobro[/eluser]
Thanks for the hint, I did such, however now when I navigate to that page, the download automatically happens. I tried moving it into it's own function, but that did not work either.
Then I decided to use the anchor() function to go to a new page, where I could echo the forced_download() inside the download function in the controller.
My only other question now resides with the anchor() function, how do you use this with an image instead of text?
Thanks for the help
Code:
<?php
class Resume extends Controller
{
function Resume()
{
parent::Controller();
}
function index()
{
$info['title'] = 'Example | Resume';
$info['page'] = 'resume';
$info['query'] = $this->db->order_by('id ASC')->get('resume');
$this->load->view('header',$info);
$this->load->view('campaign');
$this->load->view('resume_view', $info);
$this->load->view('footer');
}
function download() //this is for a new page call.
{
$this->load->helper('download');
$info['data'] = @file_get_contents("com/resume.pdf"); // Read the file's contents
$info['name'] = 'com/resume.pdf';
$this->load->view('header',$info);
$this->load->view('campaign');
$this->load->view('resume_view', $info);
$this->load->view('footer');
}
}
?>
anchor code:
Code:
<?= anchor('/resume/download', 'download');?>
I'll look it up in the wiki and scour the forums to see if there is any info about this.
Thanks!