umask(000); how and where? ( 5 Views )
-
My server tells me I need to place umask(000); in the script on the page where files are uploaded to server, to preserve permissions on the folder. These files do need to be written to/edited in the future.
I've looked at php.net but where and how do you place umask? Do you really need four characters paranthesized and not three?
Does umask(000); also need to be placed on pages that fopen and fwrite these files when they are edited? Or is the first time by itself really enough; when the files are created.
(halit, Austria)
I think that this is the correct way to do it when you set the permissions for a file/folder.
PHP Code:
$old_umask = umask(0); // set the value of the old umask to $old_umask
chmod('/www/filename.php', 0777); // remember to put a zero first!
umask($old_umask); // restore the umask
-- lilleman
(kamil, Hong Kong)
umask, chmod & permissions
Quote:
Originally Posted by lilleman
|
Quote:
Originally Posted by lilleman
PHP Code:
$old_umask = umask(0); // set the value of the old umask to $old_umask chmod('/www/filename.php', 0777); // remember to put a zero first! umask($old_umask); // restore the umask
|
Thanks lilleman,
So this changes access to files I don't have permissions to, and I'll need to use umask when files are created (Run code seperately to change file permissions)?
My server says that permissions are set at 022 to "strip write permissions"
Don't know if that translates number per number, to your example. But I take it this would be //,0022); //
I'm using file upload, is umask put among actual upload area or elsewhere?
HTML Code:
[color=black][color=#f1f1f1]<input type="file" name="ResDetails" size="32">
<input type="submit" name="MM_insert" value="Upload R">
[/color][/color]
(sinan, Algeria)
Related Topics ... (or search in 1.720.883 topics !)
network connections 30,000,000,000,000 packets sent and only 14 received? (5) 300 000 - 360 000 pages = 50 000 - 60 000 ad impressions :( ??? (18) network connections 30,000,000,000,000 packets sent and only 14 received? (5) when does umask(0) matter? (3) default umask for certain users (2) umask for specific directory (1) umask (), octal numbers (5) umask for specific directory (1) the $$ 60,000,000,000 man's sketchbook : updated 06-011 (nudity) (40)
copyright © 2007-2031 Pfodere.COM ( 4 Pfoyihuee Online )
|