samedi 1 décembre 2018

How to call function with parameter in view to Force Download in codeigniter

I want to call function download when I click the Download Text, but my href always showing php error. I got stuck here and confuse how to do it.

This is my view :

<?php $i=1; foreach($map as $dokumen)
{
?>
    <tr>
    <th scope="row"><?php echo $i?></th>
    <td><?php echo $dokumen?></td>
    <td><?php $path = 'file/dokumenkp/' . $dokumen;?>
    <a href="<?php echo base_url(). 'dokumenkp/downloadfiles' . $path['path']; ?>">Download</a>
    </td>
    </tr>
<?php $i++?>
<?php
}?>

And this is my function in Controller :

public function downloadfiles($path)
{
    force_download($path, NULL);
}




Aucun commentaire:

Enregistrer un commentaire