I want to display a pdf file in modal window
Code:
`gallery` (
`certid` bigint(20) NOT NULL,
`file_name` varchar(200) NOT NULL,
)
Code:
<button type="button" class="fa fa-eye" data-toggle="modal" data-target="#myModal1"
href="<?= base_url().'users/download/'.$row['markid']; ?>" > </button>
</td>
Code:
public function download($markid)
{
if(!empty($markid))
{
$this->load->helper('download');
$fileInfo = $this->User_model->getRows(array('markid'=>$markid));
$file='uploads/files/'.$fileInfo['file_name'];
force_download($file,NULL);
}
}
Code:
function getRows($params = array()){
$this->db->select('*');
$this->db->from('gallery');
$this->db->where('certid',$params['markid']);
// $this->db->where('status','1');
// $this->db->order_by('created','desc');
if(array_key_exists('certid',$params) && !empty($params['certid'])){
$this->db->where('certid',$params['certid']);
//get records
$query = $this->db->get();
$result = ($query->num_rows() > 0)?$query->row_array():FALSE;
}else{
//set start and limit
if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
$this->db->limit($params['limit'],$params['start']);
}elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
$this->db->limit($params['limit']);
}
//get records
$query = $this->db->get();
$result = ($query->num_rows() > 0)?$query->result_array():FALSE;
}
//return fetched data
return $result;
}
no display. need help.