PHP Online Decompression zip file Method _php Tutorial

Source: Internet
Author: User
Tags php online

PHP Online Decompression zip file method


This article mainly introduces the PHP online decompression zip file method, contains a more complete upload and zip decompression function, very practical value, the need for friends can refer to the next

The example in this article describes how PHP extracts zip files online. Share to everyone for your reference. The specific analysis is as follows:

In the PHP function library only found a zlib function also with compression somewhat, but I was disappointed that he did not solve the zip file, but finally let me find the solution, is through the PHP program execution function to achieve this function, because now can solve the zip file is too much, If you do not believe, you can go to the download software where to look for, categorization malleability you will not be disappointed, my words will not be wrong.

Here is the original file of the program, the upload.php code is as follows:

 
 
  1. 0>
  2. If the file is *.zip, it will be automatically decompressed.
  3. >
  4. 2 align=center>
  5. class =iwhite>
  6. class =iwhite>
  7. The upsave.php code is as follows:
  8. The code is as follows:
  9. //Save the uploaded file
  10. $filename = $myfile _name;
  11. Copy ($myfile, $filename);
  12. Unlink ($myfile);
  13. //Determine if it is a zip file
  14. $expand _name=explode (., $filename);
  15. if ($expand _name[1] = = Zip or $expand _name[1] = = Zip)
  16. {
  17. $str =pkunzip.exe-e $filename;
  18. EXEC ($STR);
  19. Unlink ($filename);
  20. }
  21. >

The above procedures I have tested, as long as the server can be put on, but the directory to have write permissions, there is a Pkunzip.exe file to be placed in the directory.

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/980581.html www.bkjia.com true http://www.bkjia.com/PHPjc/980581.html techarticle PHP Online Decompression method of the zip file This article mainly introduces the PHP online decompression zip file method, contains a more complete upload and zip decompression function, very practical value, the need for friends ...

  • Related Article

    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.