0
Good evening! I’m using the function force_download()
to download a file. However, I need to do this same procedure, but with downloading several files at the same time. I implemented a code, the logic I used is not performing such a procedure. Can anyone give me a hint of what I can do?
Controller:
public function download($id = NULL){
$this->load->helper('download');
$download = $this->db->query('SELECT * FROM arquivos WHERE protocolo_id ='.$id);
foreach ($download->result() as $itens){
$diretorio = file_get_contents('./uploads/'.$itens->arquivo);
$arquivo = $itens->arquivo;
force_download($arquivo, $diretorio);
}
}
Theoretically it worked, only when you extracted the zip file, it did not display the images. says: "Windows Photo Preview cannot open this image because it does not support this format..." Problem only in the files I download. Have some configuration to do?
– Andrew Maxwell
It worked, yeah, I just changed the position of
file_get_contents
as second parameter. For the first is the file name and the second is the file content. Tanks!– Andrew Maxwell