I’m using this…
$resumePath = APPPATH."../public/uploads/resume/";
//print_r($fileNames);
//Array ( [0] => 1.docx [1] => 1.docx [2] => 3.docx [3] => 4.docx [4] => 5.docx [5] => 7.docx [6] => 8.docx [7] => 9.docx [8] => 10.docx [9] => 10.docx )
$this->load->library('zip');
foreach ($fileNames as $files) {
if (is_file($resumePath . $files)) {
$this->zip->read_file($resumePath . $files);
}
}
$this->zip->download('backup.zip');
It works fine, but when i try to unzip with Winzip or Winrar. it show me:
C:\Users\User\Downloads\backup.zip: The archive is either in unknown format or damaged
Zip File Curruped is Solved but now I am getting the file is currupted inside the zip archive...i mean after extracting when i open the doxc file its showing me file is currupted or damaged..and one more thing the size of the doxc file is now showing 45
or 55
where as when downloading with read_file
the size is showing properly(ex: in the image above)..but now its showing only two digit number...please help any one..
Updated Code:
the below code allow me to extract but when i open docx file it shows file is damaged::
foreach ($fileNames as $files) {
if (is_file($resumePath . $files)) {
**$this->zip->add_data($files, $resumePath . $files);**
}
}
the below code showing right size of the file but not allowing me to extract the file:
foreach ($fileNames as $files) {
if (is_file($resumePath . $files)) {
**$this->zip->add_data($files, file_get_contents($resumePath . $files));**
}
}
any ideas.. would be a great help... thanks in advance