Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
Creating gz compressed files with php
Category : PHP / MySQL | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

QUICK TUTORIAL

This example is found in the PHP .CHM manual released by http://ww.php.net
I have tested it personally, it works brilliant.

It reads all the contents from file MyDataFile.txt, compress it and save results into a variable $gzdata, and save that data to file called New.txt.gz, which can easily be opened via WINZIP, WINRAR or any program supports opening GZ files.

This is best for creatign backups.


CODE
<?
   $file_to_compress = "MyDataFile.txt"; //any type of file
   $gz_file_to_produce=""New.txt.gz";

   $data = implode("", file($file_to_compress));
   $gzdata = gzencode($data, 9);
   $fp = fopen($gz_file_to_produce, "w");
   fwrite($fp, $gzdata);
   fclose($fp);
?>



All rights reserved - swish-db.com