Kevin1991 Posted December 7, 2007 Share Posted December 7, 2007 I'm a novice PHP coder. I'm testing php using my own pc (http://localhost/). I need help to create a folder using mkdir() and save registered user's file (file uploads,avatar etc.) In this file C:\Inetpub\wwwroot\register\index.php, I need to create a folder at C:\Inetpub\wwwroot\profiles\<username> when I use the code like this: mkdir('..\profile\newuser01', 0775, TRUE); result says error because permission denied. but when I change it into mkdir('\profile\newuser01', 0775, TRUE); It works but will create a folder at C:\ what should I do? I saw some article says changing owner or permission at parent folder but I don't understand. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 7, 2007 Share Posted December 7, 2007 try mkdir('\Inetpub\wwwroot\profile\newuser01', 0775, TRUE); and if that works, decide whether you're going with 'profile' or 'profiles'.. you used both above... PhREEEk Quote Link to comment Share on other sites More sharing options...
Kevin1991 Posted December 7, 2007 Author Share Posted December 7, 2007 No... Still not work :'( Any help is appreciated!! I need a code that will work at a server. Do I need physical path or something...? May I ask what is the physical path for localhost? Quote Link to comment Share on other sites More sharing options...
Cep Posted December 7, 2007 Share Posted December 7, 2007 Hi there, With Windows you have to specify the entire path, so it would be, mkdir(c:/Inetpub/wwwroot/profile/newuser01); You do not need the mode as windows ignores this. The only thing you need to make sure is that IUSR_servername has write permissions on the folder. Quote Link to comment Share on other sites More sharing options...
Kevin1991 Posted December 7, 2007 Author Share Posted December 7, 2007 How do I check the permissions? I've edited the permission of profile folder in IIS (write checked) but still no work Quote Link to comment Share on other sites More sharing options...
Cep Posted December 7, 2007 Share Posted December 7, 2007 You need to go to the parent folder in My Computer. You then need to right click the parent folder (I would probably choose your profile folder as the parent) then go into properties -> security -> add -> type the IUSR_servername (where servername is the name of your computer) and then give them read & execute/write/read permissions. Quote Link to comment Share on other sites More sharing options...
Kevin1991 Posted December 8, 2007 Author Share Posted December 8, 2007 Did you mean edit these settings in ISS? I've changed but still no work. Any show me a sample to create a folder step by step? (That will work in localhost) Quote Link to comment Share on other sites More sharing options...
Cep Posted December 10, 2007 Share Posted December 10, 2007 You don't edit these settings in IIS you navigate to your inetpub folder using My Computer and then use the folder properties to bring up the security tab. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.