Welcome Guest, Not a member yet? Register   Sign In
Zip library - Adding file to specific directory inside zip
#1

[eluser]Computerzworld[/eluser]
Hello,
I am using CI Zip library for creating zip. I have one folder & one separate file that can be converted to zip. What I want is to place that particular file inside that folder. How can I do this?

I have used this code for creating zip from file & folder.


Code:
$this->zip->read_dir('./mydir/');
        $this->zip->read_file('./assets/site/myfile.php');

        $this->zip->download('Mysite_'.$this->session->userdata('title').'_'.date('Y-m-d_H:i:s'));

As myfile.php is created programatically, it is in separate folder & i need all files of mydir to be zipped & myfile.php should be placed inside mydir zip. Currently it is creating zip with myfile.php & mydir at the same level.How can I do that? Please help me. Thanks in advance.
#2

[eluser]Computerzworld[/eluser]
problem solved! I used $this->zip->add_data() & provided specific folder path for adding the file & it worked.

HTH...




Theme © iAndrew 2016 - Forum software by © MyBB