0

I'm sending compressed file in .zip extension from Android via PHP to IIS server. Almost is working everything, but I cannot achieve unzip file 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.

HaOx
  • 1,799
  • 5
  • 24
  • 36
  • Possible duplicate of http://stackoverflow.com/questions/8889025/unzip-a-file-with-php . Also, dont use `$barra = "/";`, that's why we have the `DIRECTORY_SEPARATOR` PHP constant. – dmmd Jun 21 '12 at 09:39
  • Thanks, it works. And thanks for advice. – HaOx Jun 21 '12 at 09:44

0 Answers0