Unzip .zip file uploaded from Android via PHP to IIS 7
- by HaOx
I'm sending compressed file in .zip extension from Android via PHP to IIS server. Almost is working everything, but I cannot achieve unzip files with php. I've this code:
<?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;
}
?>
So, how can I unzip uploaded file? I tried so many methods but no one worked.
I'd be appreciated if someone could tell what I have to do to unzip the uploaded file. And if I have to configure some parameters in php.ini or IIS server.
Thanks in advance.