Learning & Integrating web technology and code help directory

How to use PHP & Zip file

No comments
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
  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. $ZipName = "myfile/myzip.zip";  
  8. require_once("dZip.inc.php"); // include Class  
  9. $zip = new dZip($ZipName); // New Class  
  10. $zip->addFile("shotdev1.txt""shotdev1.txt"); // Source,Destination  
  11. $zip->addFile("shotdev2.txt""shotdev2.txt");  
  12. $zip->addDir("MySub"); // Add Folder  
  13. $zip->addFile("shotdev3.txt""MySub/shotdev3.txt"); // Add file to Sub  
  14. $zip->addFile("shotdev4.txt""MySub/shotdev4.txt");  
  15. $zip->save();  
  16. echo "Zip Successful Click <a href=$ZipName>here</a> to Download";  
  17. ?>  
  18. </body>  
  19. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP Zip file

No comments :

Post a Comment