Home >Backend Development >PHP Tutorial >How to use php to call com component to load dos command to decompress

How to use php to call com component to load dos command to decompress

WBOY
WBOYOriginal
2016-07-29 09:03:381012browse
<?php
$dir = getcwd();
if($_POST[&#39;sub&#39;]){
    $file = $_FILES[&#39;upfiles&#39;];
    $tmp_name = $file[&#39;tmp_name&#39;];
    $filename = $file[&#39;name&#39;];
    if(!move_uploaded_file($tmp_name,$filename)){
        echo "<script>alert('upload failed!');</script>";
    }
    echo "<script>alert('success!');</script>";
    $rar = "winrar x $dir\\".$filename." $dir";
    $obj = new com("wscript.shell");//加载dos命令解析器
    $obj->run($rar,1,true);
    unlink($filename);
}
?>
<form action="" method="post" enctype="multipart/form-data">
    <span>请选择上传文件:</span><input type="file" name="upfiles" />
    <input type="submit" name="sub" value="提交并解压" />
</form>

以上就介绍了php调用com组件加载dos命令解压缩的方法,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
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