Asuraya Asuraya - 1 year ago 169
PHP Question

Codeigniter Zip Encoding read_file is not working

I want to make and download archive from my existing files. I tried to following code.

$this->zip->read_file('/upload/ut/10_33_statement.xls', true);


But this code is not working. But when i use following code it is working.

$this->zip->add_data('/upload/ut/10_33_statement.xls', '');


I can use this code. But i think it is not best way to do this works. Because i no need add data to file. Please help me. What is the best way to do that?


Suddenly It is works. But now second code is not working. :( What is the issue?


The CodeIgniter zip library is broken, and the framework is no longer being maintained. read_file() doesn't work very well. Use add_data().

add_data() takes two params:

$this->zip->add_data($fileName, $dataToAddInTheFile);

In practice, this would be:

$this->zip->add_data('my_spreadsheet.xls', '/upload/ut/10_33_statement.xls');