Php online ZIP file decompression method, _ PHP Tutorial

Source: Internet
Author: User
Tags php online
Php decompress the ZIP file online ,. Php decompress the ZIP file online. This article describes how php decompress the ZIP file online. Share it with you for your reference. The specific analysis is as follows: only the PHP online ZIP file extraction method is found in the php function library,

This article describes how to decompress the ZIP file online by using php. Share it with you for your reference. The specific analysis is as follows:

In the PHP function library, only ZLIB functions are found to be related to compression, but I was disappointed that he could not solve the ZIP file, but in the end, I still found a solution, that is, to implement this function through the PHP program execution function, because there are too many things that can solve ZIP files now. if you don't believe it, you can go to the place where you have downloaded the software to find it. make sure that you will not be disappointed. I will not be wrong.

The following is the original file of the program. The upload. php code is as follows:

The code is as follows:










If the file is *. ZIP, it will be automatically decompressed.







The upsave. php code is as follows:

The code is as follows:

<? Php
// Save the uploaded file
$ Filename = "$ MyFile_name ";
Copy ($ MyFile, "$ filename ");
Unlink ($ MyFile );

// Determine whether the file is a ZIP file
$ Expand_name = explode (".", $ filename );
If ($ expand_name [1] = "zip" or $ expand_name [1] = "ZIP ")
{
$ Str = "pkunzip.exe-e $ filename ";
Exec ($ str );
Unlink ($ filename );
}
?>


The secret file should also be placed in this directory.

I hope this article will help you with php programming.

Example: This article describes how to decompress the ZIP file online by using php. Share it with you for your reference. The specific analysis is as follows: in the PHP function library, only...

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.