Jump to content

Create File chmod error


flyersun

Recommended Posts

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

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

 

 

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);

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.