/**
* Zip file Creation class.
* Makes zip files.
*
* @access Public
*/
Class ZipFile
{
/**
* Array to store compressed data
*
* @public Array $datasec
*/
Public $datasec = Array ();
1. zip file Directory Traversal introductionBecause the ZIP archive is allowed to exist in the package file ". /"string, an attacker could take advantage of multiple". /"Change the location of a file in the ZIP package when extracting, overwriting
As we all know, zip is a compressed file format, MAC OS default supported file format, at that time occasionally when you open the zip file you want to unzip, but automatically become a cpgz file without decompression, and then double-click the Cpgz
Example 1. download the prepared zip file first. php tool class. after downloading and decompressing the file, put the file in the corresponding directory. I put it in the include folder under the virtual directory. 2. add the following code to your
This article provides a detailed analysis of how php generates zip files. For more information, see
This article provides a detailed analysis of how php generates zip files. For more information, see
The Code is as follows:
Require_once
$ Z = new phpzip ();
$ File = array('itokit.jpg ');
$ Zipname = './itokit_com/'. Time (). '.zip ';
$ Z-> zip ($ file, $ zipname );
/**The following are other methods that call this class:$ Z = new phpzip (); // create a zip class
Method 1:$ Z->
1. Download the zip. php tool class that I have prepared, decompress it, and put the files in the directory. I put the files in the include folder under the virtual directory.2. Add the following code to your php file:Copy codeThe Code is as follows:
This article provides a detailed analysis of how php generates zip files. For more information, see
The code is as follows:
Require_once "./include/zip. php ";$ Zip = new PHPZip ();// $ Zip-> createZip ("directory address of the folder to be
Example of zip compression for php files1. Download the zip. php tool class that I have prepared, decompress it, and put the files in the directory. I put the files in the include folder under the virtual directory.2. Add the following code to your
Copy codeThe Code is as follows:Require_once "./include/zip. php ";$ Zip = new PHPZip ();// $ Zip-> createZip ("directory address of the folder to be compressed", "file name .zip"); // only generate files that are not automatically downloaded$ Zip->
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.