Hmmm... okay I have no checked all the retrun values as you quite rightly suggested and it appears that $tar->error contains...
"No such file or directory"
That is not good.. so I checked and double checked that the file is there, it is. So I thought to make sure I would do an exsits file test (-e) The test found the file.
So why would Archive::Tar report that the file wasn't there when an exsits test says the file is there?
Here's the revised code
sub extractTarFile{
print $cgi->header();
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(
+time);
$year = $year + 1900;
$mon = &formatDigit($mon ++);
$mday = &formatDigit($mday);
$hour = &formatDigit($hour);
$min = &formatDigit($min);
$sec = &formatDigit($sec);
$submissionID = "$year-$mon-$mday-$hour-$min-$sec-$user_Name"; #
+yyyy-mm-dd-hhmmss
mkdir "$submittedFiles/$submissionID", 0777 or warn "Cannot make d
+irectory: $!";
copy ("$tmpFilePosition", "$submittedFiles/$submissionID/$user_Fil
+e_Filename");
$tarLocation = "$submittedFiles/$submissionID/$user_File_Filename"
+;
$RC_open = open TARFILE, $tarLocation;
if (-e TARFILE){
print $cgi->p("File exsists");
}
$RC_new = $tar = Archive::Tar->new();
$RC_extract = $tar->extract_archive("TARFILE");
$tar_errors = $tar->error();
print $cgi->p("Return Val open ($RC_open)");
print $cgi->p("Return Val New tar ($RC_new)");
print $cgi->p("Return Val Extract ($RC_extract)");
print $cgi->p("Tar Location is ($tarLocation)");
print $cgi->p("Tar errors ($tar_errors)");
print $cgi->p("submittedFiles ($submittedFiles)");
print $cgi->p("submissionID ($submissionID)");
print $cgi->p("userFileFilename ($user_File_Filename)");
close TARFILE;
}
And the new output from the browser...
File exsists
Return Val open (1)
Return Val New tar (Archive::Tar=HASH(0x3be9cc))
Return Val Extract ()
Tar Location is (/webroot/service/servicelist_submission/submitted_files/2002-09-08-08-32-25-Mark/sample.tar)
Tar errors (No such file or directory)
submittedFiles (/webroot/service/servicelist_submission/submitted_files)
submissionID (2002-09-08-08-32-25-Mark)
userFileFilename (sample.tar)
Whilst I'm at it I'll show you the permissions on the files as well although I don't think it's that...?...
mf139823@esweb: pwd
/apps/webroot/service/servicelist_submission/submitted_files/2002-09-08-08-32-25-Mark
308 mf139823@esweb: ls -l
total 932
drwxr-xr-x 2 nobody nobody 512 Oct 8 08:32 ./
drwxrwxrwx 23 mf139823 staff 1024 Oct 8 08:32 ../
-rw-r--r-- 1 nobody nobody 461824 Oct 8 08:32 sample.tar
mf139823@esweb
Am I doing something crazy?
Please help!
M |