Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to zip a folder using php

<?php
  
// Enter the name of directory
$pathdir = "Directory Name/"; 
  
// Enter the name to creating zipped directory
$zipcreated = "Name of Zip.zip";
  
// Create new zip class
$zip = new ZipArchive;
   
if($zip -> open($zipcreated, ZipArchive::CREATE ) === TRUE) {
      
    // Store the path into the variable
    $dir = opendir($pathdir);
       
    while($file = readdir($dir)) {
        if(is_file($pathdir.$file)) {
            $zip -> addFile($pathdir.$file, $file);
        }
    }
    $zip ->close();
}
  
?>
Comment

PREVIOUS NEXT
Code Example
Php :: update sql php 
Php :: php array size 
Php :: php session time out default 
Php :: laravel where first 
Php :: a facade root has not been set phpunit 
Php :: how to get auth user name in laravel 
Php :: ob_start in php 
Php :: eloquent get distinct 
Php :: laravel route view 
Php :: random number laravel faker 
Php :: woocommerce order get_data() 
Php :: start server cmd php 
Php :: laravel php artisan tinker test email 
Php :: Type error: Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() 
Php :: mysql_fetch_array php 
Php :: php regex file extension 
Php :: php explode multiple delimiters 
Php :: how to add property to an object in php 
Php :: how to replace multiple characters in a string in php 
Php :: minus 1 year php 
Php :: laravel create search 
Php :: how to use multiple permission in blade 
Php :: wordpress add to cart redirect php 
Php :: php creazione numero random 
Php :: Excerpt/ get post content 
Php :: self submit form php 
Php :: how to create wordpress shortcodes 
Php :: php date from format 
Php :: display all errors in blade laravel 
Php :: skip add to cart for woocommerce 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =