Welcome Guest, Not a member yet? Register   Sign In
codeigniter
#1

can anybody help me on this issue of download as pdf file ?
controller
function download($serial)
{
$file = $this->reports_model->get_cycledata($serial);
$data=file_get_contents($file->full_path);
$name=$file->file_name;
force_download($name,$data);
}
view
function get_cycledata($serial)
{

$this->db->select('cycle_timestamp,cycle_18_INT,cycle_03_INT,cycle_06_INT,cycle_08_INT,cycle_17_INT');
$this->db->from('cycles');
$this->db->where('cycle_serial', $serial);
$this->db->order_by("cycle_timestamp","asc");
$query = $this->db->get();
return $query->result();
}
view
anchor('http://75.148.73.50/index.php/report/download/'.$crow->machine_serial,'<span class="glyphicon glyphicon-download" title="download file"></span>')
Reply




Theme © iAndrew 2016 - Forum software by © MyBB