<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Document Decompression Management </title>
<body>
<?php
In PHP versions earlier than 4.1.0, $HTTP _post_files should is used instead
of $_files.
if (Isset ($_post["Submit")) {
echo "FileName:". $_post[' Unpackfile ']. "<br/>\n";
echo "Unpackpath:". $_post[' Unpackpath ']. "<br/>\n";
$zip = Zip_open ($_post[' unpackfile '));
if ($zip) {
while ($zip _entry = Zip_read ($zip)) {
echo "Name:". Zip_entry_name ($zip _entry). "<br/>\n";
echo "Actual Filesize:". Zip_entry_filesize ($zip _entry). "<br/>\n";
echo "Compressed Size:". Zip_entry_compressedsize ($zip _entry). "<br/>\n";
echo "Compression method:". Zip_entry_compressionmethod ($zip _entry). "<br/>\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!<br/>\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!<br/>\n";
} else {
mkdir ($_post[' Unpackpath '). " /". Zip_entry_name ($zip _entry), 0777);
echo "mkdir successful!<br/>\n";
}
}
echo "<br><br>\n\n";
}
Zip_close ($zip);
}
?>
</body>
<?php
Exit ();
}
?>
<form id= "Form1" Name= "Form1" enctype= "Multipart/form-data" "method=" Post "action=" <?=$_server[' php_self ']? > ">
To extract the file <input type= "text" name= "Unpackfile"/>
Decompression path <input type= "text" name= "Unpackpath"/>
<input type= "Submit" name= "submit" value= "decompression"/>
</form>
</body>