开发者

What mode should I use when I create a folder for uploaded files

I have this directory structure:

\htdocs
\htdocs\uploadfiles\

Now if a user's id is s001, then I should create a new folder for this user to store uploaded files.

\htdocs
\htdocs\uploadfiles\
\htdocs\uploadfiles\s001\

Here are my questions:

Q1> What mode should I use for \htdocs\uploadfiles
Q2> What mode shou开发者_开发技巧ld I use for \htdocs\uplaodfiles\s001\

Based on http://www.elated.com/articles/understanding-permissions/ The function I use to create the folder for the user is as follows:

mkdir("/htdocs/uploadfiles/s001/", 0700);

That means only the owner of the s001 has access read/write/execute. But I don't know whether or not this is correct and practical.


That is correct. Make the owner of the directory the same user as the web server. Add ACLs to all of the directories if you need other users to have access.


The will be 777 to /uploadfiles and rest 755 while creating folder

mkdir("/htdocs/uploadfiles/s001/", 0755);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜