File perms when dir already exists
| From: | rw at xend dot net | Date: | Sat, 18 Jan 2003 23:23:13 +0000 |
| Subject: | File perms when dir already exists | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132132@lists.php.net to get a copy of this message | ||
Hello all!
I have a number of scripts that upload 5 files at a time each.
The first one creates the dir using umask(000)and mkdir($dir,0777)
which gives the first five files perms 777, which is what I want.
I have the subsequent scripts check if the dir exists and if not does the same
thing with umask and mkdir. The problem is the uploaded files in scripts 2
through 5 do not inherit the perms 777.
The script:
if (!is_dir("/mnt/ls6/17/169/00000000/htdocs/2003/uploads/$mls")){
umask(000);
mkdir($dir,0777)or die("couldn't create directory");
}
$path1=$dir . "/1.jpg";
move_uploaded_file( $upload1, $path1)or die("couldn't upload photo");
$sql = (" UPDATE gallery SET img1 = '1' WHERE mls = '$mls';");
Is there a parameter I can include in move_uploaded_file() to set the perms on
the remaining files?
Any help is greatly appreciated.
RW