• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to display a pdf file in modal window.

#1
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.
Reply

#2
I don't think your button can work this way.
You are using Bootstrap and FontAwesome right?
Try this:
PHP Code:
<td><?= anchor('users/download/'.$row['markid'],'<i class="fa fa-eye"></i>');?></td> 

Typically, force_download will trigger your browser to ask the user whether he wants to save or open the document.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.