0

I'm trying to add a large number of pictures to a zip file and at some point, the _add_date private function that concatenates the string data fails. What kind of work around could I use ? Should I increase the compression level ? Can I just append the files one by one to the archive ?

Here's the method that fails.

function _add_data($filepath, $data, $file_mtime, $file_mdate)
(...)
$this->zipdata .=
        "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00"
        .pack('v', $file_mtime)
        .pack('v', $file_mdate)
        .pack('V', $crc32)
        .pack('V', $compressed_size)
        .pack('V', $uncompressed_size)
        .pack('v', strlen($filepath)) // length of filename
        .pack('v', 0) // extra field length
        .$filepath
        .$gzdata; // "file data" segment
(...)
}
DD.
  • 31
  • 4
  • [Here's a discussion](http://stackoverflow.com/questions/5745255/php-aborting-when-creating-large-zip-file) about using php's [ZipArchive](http://php.net/manual/en/class.ziparchive.php). This [answer suggests 4 reasons it's failing](http://stackoverflow.com/a/21694957/3585500). One might apply to yours, even though you're not using ZipArchive. – ourmandave Feb 14 '17 at 02:26
  • [CI also comes with a zip library.](https://www.codeigniter.com/userguide3/libraries/zip.html) – ourmandave Feb 14 '17 at 02:31
  • That's CI Zip library that fails – DD. Feb 14 '17 at 09:52

0 Answers0