Hi,
I have been trying to use the exec() within the php code to extract the tar file but it doesnt seem to work.
Heres my code
<?php
$uploaddir = '/var/www/html/uploads/';
print "<pre>";
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $uploaddir . $HTTP_POST_FILES['userfile']['name']))
{
print "File is valid, and was successfully uploaded. Here's some more debugging info:\n";
print_r($HTTP_POST_FILES);
exec('tar -xf /var/www/html/uploads/images.tar');
}
else
{
print "Here's some debugging info:\n";
print_r($HTTP_POST_FILES);
}
?>
It does upload the tar file into the /var/www/html/uploads folder but doesnt extract the files. However, if I navigate to /var/www/html/uploads with the command prompt and then manually run tar -xf /var/www/html/uploads/images.tar a new directory structure is created within the upload folder -/var/www/html/uploads/ containing 9 images (the contents of the tar file).
Could there be a problem with user/folder permissions? Since the orginal "var" folder as the following permissions.
Owner : Read Write Execute
Group : Read Write Execute
Others : Read Execute
But I dont think it's wise to allow Others to write. Dont Know?
Also, I was wondering is there any performance and security issues using exec() on the server?
I would be grateful for any help, thanks and regards.
Dinesh