Create Zip file on the fly with PHP


A short search on Google has lead me to theCreate ZIP File PHP class fromĀ Rochak Chauhan.

This class can create ZIP archives from lists of files.

The class provides means to add individual files or whole directories to the list of files packed into a ZIP archive.

The class can generate the packed archive as a string value.

The class can also output the necessary request response headers to serve the generated ZIP archive for download.

The supplied example demonstrates how to use the class to store the ZIP archive in a file, serve it for download and delete the file after it is served.

$fileContents = file_get_contents("img.jpg");
$createZip -> addFile($fileContents, "dir/img.jpg");

$fileName = "archive.zip";
$fd = fopen ($fileName, "wb");
$out = fwrite ($fd, $createZip -> getZippedfile());
fclose ($fd);

$createZip -> forceDownload($fileName);

Windows Update Error 80072EE2 – Hyper-V Guest


Setup a new 2008 R2 Server on a new Hyper-V server, Windows Update would sometimes work however it completely stopped. Luckily Nick Whittome had already figured it out. All you have to do is disable checksum offload.

Check out his original blog post

Go to Top