phparraysziplimitphp-ziparchive

ZipArchive Limits? PHP


I have a ZipArchive script used for a 'download basket' feature on my site. Users pick the audio they'd like to add to the basket, then the script authenticates the user and grabs all the secured files and adds them to the zip ready for download.

Once the zip is downloaded the code then deletes the file. That's all working well, however I'm running into a problem regarding bigger files! If users want to zip tracks that total over 250mb, the temp zip file that get's written never gets larger than 250mb - it just gets overwritten and starts again.

My two questions would then be:

  1. Does ZipArchive have a limit to files being written?
  2. Does ZipArchive have a different way of writing the files to make bigger files?

Appreciate your help.


Solution

  • A limit of ZIP file is 4 GB of compressed file. For larger of 4 GB you need split it separely.

    But it can depends on memory_limit() if you on-the-fly ZIP it will be on lower capacity.

    Does ZipArchive have a different way of writing the files to make bigger files?

    No. But you can split your archiver if you want and later join on extracting as string.