Welcome Guest, Not a member yet? Register   Sign In
Making a valid zip file
#3

[eluser]rschla104[/eluser]
Finally got it:

Code:
$this->load->library('zip');
$this->load->helper('file');

$dest = './folders/user01.zip';

$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(getcwd().'/folders/user01/'));

foreach ($iterator as $key=>$value) {
   $exploded = explode('user01\\',$key);
   $this->zip->add_data($exploded[1], read_file($key));
}

$this->zip->archive($dest);

Hope this helps someone. Would have saved me a few hours.


Messages In This Thread
Making a valid zip file - by El Forum - 02-01-2011, 07:15 PM
Making a valid zip file - by El Forum - 02-01-2011, 10:10 PM
Making a valid zip file - by El Forum - 02-01-2011, 10:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB