web 2.0

How to use PHP & Zip file

How to use PHP & Zip file This is Learn / tutorial php programming how to usingĀ  PHP and Zip function.

ShotDev Focus:
- PHP & Zip (Zip file)

Example

php_zip.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$ZipName = "myfile/myzip.zip";
require_once("dZip.inc.php"); // include Class
$zip = new dZip($ZipName); // New Class
$zip->addFile("shotdev1.txt", "shotdev1.txt"); // Source,Destination
$zip->addFile("shotdev2.txt", "shotdev2.txt");
$zip->addDir("MySub"); // Add Folder
$zip->addFile("shotdev3.txt", "MySub/shotdev3.txt"); // Add file to Sub
$zip->addFile("shotdev4.txt", "MySub/shotdev4.txt");
$zip->save();
echo "Zip Successful Click <a href=$ZipName>here</a> to Download";
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_zip.php

Screenshot

PHP Zip file
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.