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. Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/ 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 Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529229 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? Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529232 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. Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529235 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); Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529249 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 Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529270 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. Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529271 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 Link to comment https://forums.phpfreaks.com/topic/103338-create-file-chmod-error/#findComment-529378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.