0

how to untar a file with tar.gz extension in php script. i have written a php script for uploading a tar.gz file amongst many files. i have to untar this file. how will the command be like?

till now what i have done is - consider for uploading i have given this path
$path="/usr/local/apache/htdocs/mydir".$_HTTP_POST_FILES[0];
since only thing i know is the $path and not the file name hence
$output=shell_exec("gunzip {$path}");( this command is succesful)
my question is now how to proceed after this?
thanks in advance

2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by carobee
0

how would the syntax be? file name is not known but while uploading the path is known. my php script is not implementing the tar command

0

here is the solution. If you don't know the filename nad it is stored in some php variable
let $filename=x.tar.gz

shell_exec("cd destination_directory; gunzip {$filename}| tar xf -;");
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.