


Keep the discussion related to Microsoft Windows You may also use r/WindowsHelp or r/TechSupport to get help with your PC.ġ. Tech Support posts are only permitted on Mondays.Welcome to the largest community for Microsoft Windows, the world's most popular computer operating system!.Var url = "function.php?page=unzip" // the script where you handle the form input.ĭata: $("#unzip").serialize(), // serializes the form's elements.Īlert(data.msg) // show response from the php script.ĭocument.getElementById("unzip"). I updated answer of Morteza Ziaeemehr to a cleaner and better code, This will unzip a file provided within form into current directory using DIR. įont-family: 'Consolas', 'courier new', monospace I updated answer of to a cleaner and better code, This will unzip a file into current directory using _DIR_. extract it to the path we determined above $path = pathinfo(realpath($file), PATHINFO_DIRNAME) So, you could do: // assuming file.zip is in the same directory as the executing script.

ALWAYS SANITIZE USER INPUT.Īs per your comment, the best way to extract the zip file into the same directory in which it resides is to determine the hard path to the file and extract it specifically to that location. Use the $_GET superglobal instead.įinally, be very careful about accepting whatever input is passed to a script via a $_GET variable. $zip->extractTo('/myzips/extract_path/') Īlso, as others have commented, $HTTP_GET_VARS has been deprecated since version 4.1. There should be no need to use system calls for this. PHP has built-in extensions for dealing with compressed files. On the other hand, the fact that this code could actually be published online somewhere as the correct way to unzip a file is a bit frightening. I can only assume your code came from a tutorial somewhere online? In that case, good job trying to figure it out by yourself.
