#upload.php <table border='0' > <form ENCTYPE="multipart/form-data" action="upsave.php" method="post">
<tr> <td>如果是*.ZIP的文件會(huì)被自動(dòng)解壓縮<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); }
?>
以上的程序我已經(jīng)測(cè)試過,只要放在服務(wù)器上就可以了,但是該目錄要有寫的權(quán)限。還有一個(gè)pkunzip.exe的文件也要放在該目錄中,該文件已經(jīng)放在了壓縮包中
|
溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!