Search code examples
phpphp-ziparchive

Split zip archive on multiparts based on size with php ZipArhive class


Problem: Split archive on parts based on parts size with ZipArchive

I have zip archive and I need split it into parts based on part size. Like if I have archive 20 MB, I need split him on archive parts 5 MB.

I can split archive based on files: 1 file = 1 archive, but in my case I can have one file with size 30 MB

I have command for exec based on zip extation for php, but use exec its not good for me.

exec('zip -r -s 4m /var/www/storage/app/split_' . $value['name'] . ' /var/www/storage/app/' . $value['path'])

Can ZipArchive do same things or you know another library for that?


Solution

  • The ZipArchive class in PHP doesn't directly provide a built-in way to split a ZIP archive into parts based on a specific size. But you can achieve this manually.