I made a function to upload files and this works correctly, now in my view I've added a link to download the file.
link in view:
<td><?php echo anchor("propostas/download/{$id}/{$record->nomepessoal}", "<i class='glyphicon glyphicon-arrow-down'></i>", ['class' => 'btn btn-primary btn-block', 'name' => 'baixar']); ?></td>
and this is function
of controller
// baixar anexo
public function download($id, $nomepessoal) {
$this->load->helper('download');
$nomearquivo = $nomepessoal."_".$id.".zip";
$path = file_get_contents(base_url()."anexos/".$nomearquivo);
force_download($path, null); // start download'
}
Error in file_get_contents
function:
Message: file_get_contents ( link ): failed to open stream: HTTP request failed! HTTP / 1.0 404 Not Found
Note: the file exists and the name is correct.