打印

用 PHP 实现上传的 ZIP 文件的解压

用 PHP 实现上传的 ZIP 文件的解压

#upload.php
<table border='0' >
<form ENCTYPE="multipart/form-data" action="upsave.php" method="post">

<tr>
<td>如果是*.ZIP的文件会被自动解压缩<br>
<INPUT NAME="MyFile" TYPE="File" size="50">
</td>
</tr>
<tr>
<td colspan='2' align="center">
<input type="Submit" value=" 上传 " class=iwhite>
<input type="reset" value=" 重填 " class=iwhite>
</td>
</tr>
</table>



</body>
</html>


<?
//upsave.php
//保存上传的文件
$filename="$MyFile_name";
copy($MyFile,"$filename");
unlink($MyFile);

//判断是否是ZIP文件
$expand_name=explode(".",$filename);
if($expand_name[1] == "zip" or $expand_name[1] == "ZIP")
{
$str="pkunzip.exe -e $filename ";
exec($str);
unlink($filename);
}

?>

以上的程序我已经测试过,只要放在服务器上就可以了,但是该目录要有写的权限。还有一个pkunzip.exe的文件也要放在该目录中,该文件已经放在了压缩包中

TOP

当前时区 GMT-4, 现在时间是 2008-8-29 21:49
ComePlay8.com
Powered by Discuz! 6.0.0 © 2001-2007 Comsenz Inc.
Processed in 0.095995 second(s), 9 queries, Gzip enabled
TOP
清除 Cookies - 联系我们 - 来玩8华人娱乐网 - Archiver - WAP
Designed By Discuz! Support Team