I have a cgi script that tries to move files.
If I run it from the command line it works perfectly, but if I load it in my browser it says:
Couldn't move myFile.txt to myFolder: Permission denied
Both in my Mac OS X system, bythe way, as on Windows XP.
If I look in my environment (%ENV) I see that there is no $ENV{USER} defined, so this strongly suggests this has to do with permissions (at least I would think)...
I can't imagine I am the first one to encounter this, but I can't find a lot about this topic here/on the net. But maybe that's just my lousy searching capabilities...
Code:
#!/usr/bin/perl -w
use strict;
use File::Copy;
print "content-type: text/html\n\n";
my $sFile = "myFile.txt";
my $sFolder = "myDir";
if( ! move($sFile, $sFolder) ) {
print "Couldn't move $sFile to $sFolder: $!<p>";
}
else {
print "Moved $sFile to $sFolder<p>";
}
If I run it from the command line it works perfectly, but if I load it in my browser it says:
Couldn't move myFile.txt to myFolder: Permission denied
Both in my Mac OS X system, bythe way, as on Windows XP.
If I look in my environment (%ENV) I see that there is no $ENV{USER} defined, so this strongly suggests this has to do with permissions (at least I would think)...
I can't imagine I am the first one to encounter this, but I can't find a lot about this topic here/on the net. But maybe that's just my lousy searching capabilities...