php下传压缩同时解压文件

WBOY
Release: 2016-06-13 13:12:07
Original
841 people have browsed it

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>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!