flyersun Posted April 28, 2008 Share Posted April 28, 2008 I'm having problems when creating files using a php script. The file is created fine but the chmod is not working even though I have set it to 0777 it's been set to 0755. mkdir("../../images/photos/$user_id/$filename1/", 0777); I really can't work out why this line of code is not working other than it being a problem with the server I'm using. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 28, 2008 Share Posted April 28, 2008 Try using absolute pathname rather then relative pathnames or at least while debugging. It looks like you might be trying to create two directories with one mkdir command. I'm not sure if that's allowed or if you have to specfiy the 'recursive' argument to do that. Check the manual: http://us3.php.net/mkdir Have you checked if the script has the proper permissions to create a file in the 'photos'directory Quote Link to comment Share on other sites More sharing options...
flyersun Posted April 28, 2008 Author Share Posted April 28, 2008 Thanks I will try the absolute pathnames! Not sure what you mean when you say I'm trying to create 2 dirs but I will check the manual. uhmm I wasn't aware that the script I was using needed special permissions what would they be? 777? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 28, 2008 Share Posted April 28, 2008 The PHP user needs to have full rights on the folder I think. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 29, 2008 Share Posted April 29, 2008 If both the $user_id and $filename directories did not exist, and you used the mkdir command like you are, it would need to create the $user_id directory and the $filename directory. That may or may not work. I'm not sure, but I think it's worth looking into, because the unix command 'mkdir' requires a special argument to do something like that. Just for curiosity, try this. It might work: mkdir("../../images/photos/$user_id/$filename1/", 0777, true); Quote Link to comment Share on other sites More sharing options...
flyersun Posted April 29, 2008 Author Share Posted April 29, 2008 Warning: mkdir() expects at most 2 parameters, 3 given in /home2/amytucke/public_html/site/php/album/createalbum.php on line 78 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 Flyersun must be using an older version of PHP. I think the recursive parameter was added in PHP 5. Quote Link to comment Share on other sites More sharing options...
flyersun Posted April 29, 2008 Author Share Posted April 29, 2008 Think I've fixed it that you for all your help 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.