[eluser]BobbyB[/eluser]
Hi everybody,
I am having trouble using force_download.
I have following code:
Code:
//Controller:
function download(){
$id = $this->input->get_post('download', TRUE);
$this->load->model('get_freebies');
$data['freebies'] = $this->get_freebies->downloadselect($id);
}
//Model:
function downloadselect($id){
$query = $this->db->get_where('freebies',array('freebiesid' => $id));
if( $query->num_rows() > 0 )
{
$row = $query->row();
$name = $row->name;
$data = file_get_contents(realpath('freebies_files/'.$name.'.jpg'));
force_download($name, $data);
}
}
I use an ajax-request to the controller using mootools(Request.HTML) which works fine when trying to delete files.
But the download does not
Nothing happens at all.
Any hints?
Cheers&Thanks;