Page 1 of 1

Default permissions when uploading files

Posted: Thu Mar 06, 2003 9:34 am
by lovasco
Dear Folks,
I have seen that a default permission of 755 is automatically set by php when uploading a new file to a UNIX machine.
I would like to know whether it is possible to change this default parameter so that files are stored with a permission of 644.
Thanks a lot,
Luca

Posted: Thu Mar 06, 2003 11:34 am
by pootergeist
you could chmod the file once you've moved it from /tmp/

move_uploaded_file(............, 'path/'.$filename);
chmod('path/'.$filename,0644);

Posted: Thu Mar 06, 2003 11:37 am
by volka
you might be as well interested in http://www.php.net/manual/de/function.umask.php

Posted: Fri Mar 07, 2003 6:49 am
by lovasco
I didn't know I could issue the chmod command; it belongs to the Filesystem functions and works fine.
Thanks you,
Luca