Decompress the zip script on the server. Copy the code as follows :! DOCTYPEhtmlPUBLIC-W3CDTDXHTML1.0TransitionalENwww.w3.orgTRxhtml1DTDxhtml1-transitional.dtdhtmlxmlnswww.w3.org1999xhtml
The code is as follows:
File decompression management
// In PHP versions earlier than 4.1.0, $ HTTP_POST_FILES shocould be used instead
// Of $ _ FILES.
If (isset ($ _ POST ["Submit"]) {
Echo "FileName:". $ _ POST ['unpackfile']."
\ N ";
Echo "UnpackPath:". $ _ POST ['unpackpath']."
\ N ";
$ Zip = zip_open ($ _ POST ['unpackfile']);
If ($ zip ){
While ($ zip_entry = zip_read ($ zip )){
Echo "Name:". zip_entry_name ($ zip_entry )."
\ N ";
Echo "Actual Filesize:". zip_entry_filesize ($ zip_entry )."
\ N ";
Echo "Compressed Size:". zip_entry_compressedsize ($ zip_entry )."
\ N ";
Echo "Compression Method:". zip_entry_compressionmethod ($ zip_entry )."
\ N ";
If (zip_entry_open ($ zip, $ zip_entry, "r ")){
$ Buf = zip_entry_read ($ zip_entry, zip_entry_filesize ($ zip_entry); // File content
Echo "step 1 successful!
\ N ";
If (zip_entry_filesize ($ zip_entry )! = 0 ){
$ Fp = fopen ($ _ POST ['unpackpath']. "/". zip_entry_name ($ zip_entry), 'wb ');
Fwrite ($ fp, $ buf );
Fclose ($ fp );
Zip_entry_close ($ zip_entry );
Echo "unpack successful!
\ N ";
} Else {
Mkdir ($ _ POST ['unpackpath']. "/". zip_entry_name ($ zip_entry), 0777 );
Echo "mkdir successful!
\ N ";
}
}
Echo"
\ N ";
}
Zip_close ($ zip );
}
?>
Exit ();
}
?>
The http://www.bkjia.com/PHPjc/317559.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317559.htmlTechArticle code is as follows :! DOCTYPEhtmlPUBLIC "-// W3C // DTDXHTML1.0Transitional //" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" htmlxmlns = "http://www.w3.org/1999/xhtml "...