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