I would like to zip a large folder in divided zip files. I used the classic codeigniter code and I would like to use popen
or stream
to it, but I have no idea how to do it. I would like for someone to help me.
My code is:
public function exportar_pastas() {
ini_set('max_execution_time', 4600);
ini_set('memory_limit','7024M');
$username="";
if($_POST){
$this->load->library('zip');
$user = $this->input->post("nome");
$users = $this->user_model->get_users();
foreach($users as $userm){
if($userm->user_id == $user){
$username = $userm->username;
}
}
$path = "../certificados/".$username;
$this->zip->read_dir($path);
$handle = $this->zip->download('my_backup.zip');
while (!feof($handle)){
echo fread($handle, 8000);
flush();
}
redirect(base_url().'admin/backup');
}else{
$this->load->view('admin/backup');
}
}