exec() -- fileupload question
Posted: Sat Dec 18, 2004 5:19 pm
I'm trying to upload an archived file and then unzip. I can get the exec() command to execute on the file after the file upload script full executes through a different .php file. But for some reason it doesn't work when the uploading is still happening...
Does anyone know a solution to this problem?
Here's my code:
It's echoing out what you would expect it to. But the zipped or tarred file doesn't unzip. The path to the file is also correct.
Thanks
Does anyone know a solution to this problem?
Here's my code:
Code: Select all
<?php
$source = $_FILES['image_directory']['tmp_name'];
$target = $storage_dir.$_FILES['image_directory']['name'];
move_uploaded_file($source, $target) or die("Could not copy $source");
if(file_exists($storage_dir.$_FILES['image_directory']['name']))
{
switch ($ext)
{
case ".zip":
exec("unzip ".$storage_dir.$_FILES['image_directory']['name']);
//echo "unzip ".$storage_dir.$_FILES['image_directory']['name'];
break;
case ".tar" :
exec("tar -xf ".$storage_dir.$_FILES['image_directory']['name']);
echo "tar -xf ".$storage_dir.$_FILES['image_directory']['name'];
break;
case ".sit":
exec("unzip ".$_FILES['image_directory']['name']);
break;
}
$message = " DUDE YOU ROCK! FILE UPLOADED!!!!!!!!";
}
?>Thanks