Skip to content

A PHP class to stream files as an uncompressed ZIP archive without a temporary file

License

Notifications You must be signed in to change notification settings

TheNeoBurn/PHP_BjSZipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

PHP_BjSZipper

A PHP class to stream files as an uncompressed ZIP archive without a temporary file

Detailed information is on CodeProject:

[3839889] Streaming ZIP File in PHP Without Temp File

General code usage

Collecting information and sending with progress bar working

require_once('BjSZipper.php');

// Create a new instance
$zip = new BjSZipper('images.zip');

// Add files and data to send
$zip->AddDir(dirname(__FILE__), true, '/\.(jpg|jpeg)/i'); // All JPEGs recursively
$zip->AddFile('/var/www/html/testdata.bin');              // Just a normal file
$zip->AddData('All the JPEG images.', 'desc.txt');        // A raw text file

// Start sending the archive
$zip->Send();

Sending immediately but without working progress bar

require_once('BjSZipper.php');

// Send the HTTP headers
BjSZipper::Begin('images.zip');

// Add files and data to send
BjSZipper::SendDir(dirname(__FILE__), true, '/\.(jpg|jpeg)/i'); // All JPEGs recursively
BjSZipper::SendFile('/var/www/html/testdata.bin');              // Just a normal file
BjSZipper::SendData('All the JPEG images.', 'desc.txt');        // A raw text file

// Send the archive directory and end the archive
BjSZipper::End();

About

A PHP class to stream files as an uncompressed ZIP archive without a temporary file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages