Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter Zip Encoding Class add multiple files

heres how I am doing now :

$path = "./uploads/1.txt";
$path1 =  "./uploads/4.txt";
$this->zip->read_file($path);
$this->zip->read_file($path1);
$this->zip->download('files_backup.zip');

Now I want to add the files from a database query which returns the path of the files .

$data['query'] = $this->db->get_where('files', array('uid'=>$uid));

now please tell me which loop that I must use in order to call $this->zip->read_file($path);

from the results of the query mentioned above..

thanks

Edit:

foreach ($query->result() as $row)
{
    echo $row->filename;
}

result

335476sfsr.txt 
egyafhwe7g.txt
4566weyt36.txt

so, it just shows the files of that user ..

like image 841
Vamsi Krishna B Avatar asked Feb 16 '26 18:02

Vamsi Krishna B


1 Answers

ok, so then just edit the given loop like so

foreach ($query->result() as $row)
{
    $this->zip->read_file($row->filename);
}

$this->zip->download('files_backup.zip');
like image 158
jondavidjohn Avatar answered Feb 19 '26 06:02

jondavidjohn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!