Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI open of tmpfile: Permission denied

Status
Not open for further replies.

blackcat99

Programmer
Feb 13, 2005
7
CA
I'm having a problem with a Perl upload script called mega-upload v1.45.

The script uploads files using a multipart form into a temporary data file stored on my site (this works fine).

Next I create a new CGI to read the data and parse it into the separate files. However I always get an permission denied error. This only happens on my web server site (and not on my local computer website).

The file directories appear to have RW permissions, and I've tried creating output files directly from the data file (rather than using tempfiles) - but get the same error.

The server uses IIS 5 | PERL: v 5.006001 | CGI.pm: v 2.752

Can anyone help???

------------------------------
The initial code successfully creates a temp file:
------------------------------
$data_file

------------------------------
But here's where the error occurs:
------------------------------
open(STDIN,"< $data_file") or die "can't open file: $! for reading";

my $cg = new CGI();
my $qstring="";
my %vars = $cg->Vars;
my $j=0;

while(($key,$value) = each %vars) {

if(defined $value && $value ne '') {

my $fh = $cg->upload($key);
if(defined $fh) {
($tmp_fh, $tmp_fn) = tempfile();
while(<$fh>) {
print $tmp_fh $_;
}
close($tmp_fh);
}
}
}
 
See the other recent thread on temporary files on IIS; the user there discovered that while his code had worked on IIS4, on IIS6 it was attempting to create its temporary files in c:\windows\system32\inetsrv instead.
 
Hi, I couldn't find that post... but do see a copy of the uploaded $data_file in the default temp dir ( c:\temp\CGItemp20732 )

How can this temp dir location be changed?

However, I still don't understand why this matters, since I'm trying to open $data_file (which is successfully saved to: c:\inetpub\ )

I need to keep working on this - but if anyone can help.. I'd get more sleep. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top