Yes, if you give the IUSR_MACHINE_NAME user read/write access to the directory containing the file then that would work for anyone running the script - as long as you haven't password protected the site.
Assuming you're using IIS, if you enable password protection, the username/password someone enters must match a local domain user and the script will then run with that user's permissions. In that case you'd want to set permissions using a group or for 'Everyone'. But if passwords are not enabled, ignore this paragraph altogether.
| [reply] |
Yes the site is password protected. So if a user logs in a uploads a file does it belong to the system or the user? If the user, how do I change it so that it belongs and can be accessed by the whole site?
| [reply] |
OK, if you're running IIS and the site is password protected, then forget everything I said about the IUSR_MACHINE_NAME user :-)
First of all, make sure you have a group that all the users are in ('Domain Users' will do). Then, give that group 'Full control' on the directory where you store the files. If that's not enough, then try adding this to your script...
chmod(0666, $filename)
... after you create the file. (Note that 0666 is an octal number, you need the leading zero and don't put it in quotes). The 'chmod' function is really a unixy thing but if it does what you need then it's a simple solution.
If 'chmod' doesn't do it, then you can use the Win32::FileSecurity module that comes with ActivePerl. This is adapted from the man page:
use Win32::FileSecurity qw(Get Set MakeMask);
my %hash;
$perms = MakeMask( qw( FULL ) );
Get( $filename, \%hash ) ;
$hash{$group_name} = $perms;
Set( $filename, \%hash ) ;
good luck
| [reply] [d/l] [select] |