Hi, all --

When I move_uploaded_file() a file into place, I want to give it the
correct permissions; by default they are 600 (rw-/---/--).  I already
have the umask set correctly for any given situation in anticipation of
creating directories, and that works for creating files from scratch, but
chmod() needs a permissions setting rather than a umask.

The challenge is in representing this as octal.  With some mucking around
I was able to print

  $u = decoct(umask()) ;
  $m = 0777 ;
  $r = decoct($m) - $u ;
  print "The setting is $r\n" ;

and get

  The setting is 664

when umask returns 113.  All is great, right?  Well, no...  I need to
convert that 664 octal value into an octal representation of

  0664

to feed to chmod() -- and apparently I can't just

  $r = 0.$r ;

my way through it, because I get a parse error.

Maybe I'm barking up entirely the wrong tree anyway.  How can I set a
file's permissions based on whatever umask() returns?


TIA & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to