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

 

 

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.