Search
 
SCRIPT & CODE EXAMPLE
 

PHP

faire un fichier zip en php

<?php 
$pathdir = "test/";  
$nomzip = "test.zip"; 
$zip = new ZipArchive;
if($zip -> open($nomzip, ZipArchive::CREATE ) === TRUE)
{ 
	$dir = opendir($pathdir); 
	while($fichier = readdir($dir)) 
	{ 
		if(is_file($pathdir.$fichier)) 
		{ 
		$zip -> addFile($pathdir.$fichier, $fichier); 
		} 
	} 
	$zip ->close(); 
} 
?>
Comment

faire un fichier zip en php

<?php
 require( "lib/zip.lib.php" ) ; //indiquez le chemin d'accès à la lib
 $zip = new zipfile( ) ; //on crée une nouvelle instance zip

 $nom_fichier = "mon_document.doc" ; //nom du fichier à compresser
 $fo = fopen($nom_fichier,'r') ; //on ouvre le fichier
 $contenu = fread($fo, filesize($nom_fichier)) ; //on enregistre le contenu
 fclose($fo) ; //on ferme le fichier

 $zip->addfile($contenu, $nom_fichier) ; //on ajoute le fichier
 $archive_zip = $zip->file() ; //on associe l'archive
 $open = fopen( "monrep/fichier.zip" , "wb"); //crée le fichier zip
 fwrite($open, $archive_zip); //enregistre le contenu de l'archive
 fclose($open); //ferme l'archive
?>
Comment

PREVIOUS NEXT
Code Example
Php :: shopware php get cookie 
Php :: wp_remote_post decode data 
Php :: change php platform of composer 
Php :: PHP str_pad — Pad a string to a certain length with another string 
Php :: remove the public from url in laravel 
Php :: How can I share limits across multiple fields gravity forms? 
Php :: Update database table row if a qualifying token is provided 
Php :: time debug php 
Php :: Random select value on array factory Laravel 
Php :: how to change directory in command processor 
Php :: cashier mollie 
Php :: Jolt transform specification input 
Php :: How to Allow Users to Delete a Post From the Front-End 
Php :: php script auf serve alle 5 minuten ausführen 
Php :: PHP Installation broken - shows strange php code as response 
Php :: PHP strcspn — Find length of initial segment not matching mask 
Php :: Delete Collection (Get) 
Php :: wp dev tehem support widget 
Php :: how to create php message 2 
Php :: Remove default product data tabs 
Php :: yii2 gridview get selected rows 
Php :: command line that convert html to php file 
Php :: remove public from laravel url 
Php :: How to increase the WordPress Multisite Network limit for Maximum Filesize Upload? 
Php :: verta sample jalali laravel problem return object 
Php :: laravel model relationships with two columns match 
Php :: lowercase in array php 
Php :: ? in php 
Php :: stripslash 
Php :: what Permissions do I need for include folder on php 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =