i'm trying to load the zip library, but for some reason i cant't, it show me this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$zip
Fatal error: Call to a member function add_data() on a non-object in C:\xampp\htdocs\cinetaller\frontend-cin\controllers\usuario.php on line 72
This is the code from my controller:
public function index(){
$this->load->library('zip');
$data = array();
$data['www'] = $this->config->item('base_www');
$data['alumno'] = $this->malumno->getById(1)->row();
echo "start zip";
$name = 'mydata1.txt';
$dataZ = 'A Data String!';
$this->zip->add_data($name, $dataZ);
// Write the zip file to a folder on your server. Name it "my_backup.zip"
$this->zip->archive($data['www'].'/uploads/'.$data['alumno']->id);
// Download the file to your desktop. Name it "my_backup.zip"
$this->zip->download('my_backup.zip');
echo "done";
}
I'm shure, that the zip library is in the core system, but for a no reason i can't load it.
try your test without the download command and see if it loads. i'm saying that because in the ci manual after
$this->zip->download()
it says: Note: Do not display any data in the controller in which you call this function since it sends various server headers that cause the download to happen and the file to be treated as binary. http://www.codeigniter.com/user_guide/libraries/zip.html