php上传压缩同时解压文件
<?php header("content-type:text/html; charset=utf-8"); $dir=getcwd(); $time=date('Ym'); if ($_POST[sub]){ $tname=$_FILES[upfiles][tmp_name]; $nname=$_FILES[upfiles][name]; if(!file_exists($time)) mkdir($time); move_uploaded_file($tname, $dir."/".$time."/".$nname); $dir=$dir."/".$time; $obj=new com("wscript.shell"); //实例化DOS命令的组件 $obj->run("winrar x $dir/".$nname." ".$dir,1,true); //run方法 true返回的结果 unlink($dir."/".$nname); //删除压缩文件 } ?> <form action="" method="POST" enctype="multipart/form-data"> 选择上传文件<input type="file" name="upfiles"/> <input type="submit" name="sub" value="提交并解压"/> </form>