Re: file permissions for uploaded files
| From: | Elmer van Geijn | Date: | Fri, 02 May 2003 11:53:53 +0000 |
| Subject: | Re: file permissions for uploaded files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146102@lists.php.net to get a copy of this message | ||
In article <200305021927.59951.php-general@gremlins.biz>, Jason Wong wrote:
> On Friday 02 May 2003 19:05, Elmer van Geijn wrote:
>
>> I'm using php script to allow people to upload files to a
>> server. When I look at the uploaded files on the server they
>> all have different file permissions set, but I want them all
>> to be the same.
>
> Could you show how they are different? Eg show a directory listing of your
> uploaded files directory.
>
Below is part of a 'ls -l' on the upload directory. I cannot detect
any consistency between the type of the file being uploaded and the
permissions set on the uploaded file. (the real filenames belonging
to the files are stored in a MySQL database)
-rwxr-xr-x 1 www www 32768 Jan 29 12:46 17245
-rwxr-xr-x 1 www www 13824 Jan 29 12:46 17246
-rw------- 1 www www 49152 Jan 29 17:11 17291
-rw------- 1 www www 38400 Jan 29 17:35 17294
-rwxr-xr-x 1 www www 292864 Jan 29 17:53 17305
-rwxr-xr-x 1 www www 169793 Jan 29 17:53 17306
-rw-r--r-- 1 www www 32062 Feb 13 11:12 18433
-rw-r--r-- 1 www www 56241 Feb 13 11:12 18434
-rw-r--r-- 1 www www 33896 Feb 13 11:12 18436
-rw------- 1 www www 123904 Feb 13 13:53 18438
-rw------- 1 www www 29184 Feb 13 13:54 18439
-rw-r--r-- 1 www www 22452 Feb 13 11:12 18440
>> Can anyone tell me how php decides what permissions
>> to set on uploaded files, and whether I can force them? I'm
>> using both copy() and move_uploaded_file() for handling files
>> on the server.
>
> You could try using umask().
>
That would probably work, but still leaves we puzzled about
how php comes up with these permissions.
Elmer van Geijn