我正在通过 PHP 将 .zip 扩展名的压缩文件从 Android 发送到 IIS 服务器。几乎可以正常工作,但我无法使用 php 解压缩文件。我有这个代码:
<?php
$target_path1 = "C:/Windows/Temp/";
$target_path1 = $target_path1 . basename( $_FILES['uploaded_file']['name']);
/* I'm making the folder */
$directorio = substr($target_path1, 0, 32);
if (!is_dir($directorio)) {
mkdir($directorio);
}
/* I declare a path */
$barra = "/";
$target_path1 = $directorio . $barra . basename( $_FILES['uploaded_file']['name']);
$target_path2 = $directorio . $barra;
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path1)) {
/* Here I want to unzip the uploaded file */
} else{
echo "There was an error uploading the file, please try again!";
echo "filename: " . basename( $_FILES['uploaded_file']['name']);
echo "target_path: " .$target_path1;
}
?>
那么,如何解压上传的文件呢?我尝试了很多方法,但没有一个奏效。如果有人能告诉我必须做什么来解压缩上传的文件,我将不胜感激。如果我必须在 php.ini 或 IIS 服务器中配置一些参数。
提前致谢。