By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

mkdir permissions help

banning
P: 42
Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($getID)){
  2.         $id=$row['id'];
  3.         $dir='../picture_library/floorplans/'.$id;
  4.         mkdir($dir,0777);
  5.         chmod($dir,0777);
  6.     }
  7.  
ok this is really starting to kill me... i've bee on this for an hour now surfing the net trying to find a solution. I am using a test server that i run on my computer to build sites and then upload (not sure if that will have any bearing).

anyway what im trying to do is OBVIOUSLY set permissions to this directory i just created BECAUSE... later on there is an option to delete...

Expand|Select|Wrap|Line Numbers
  1. unlink('../picture_library/floorplans/'.$id.'');
  2.  
however everytime i goto delete it says i don't have permissions... and clearly when i created the directory i set the permissions (at least im sure i did). Anyway any and all help would be had. Thanks guys.

i just tried this i dont know if it will help but i ran

Expand|Select|Wrap|Line Numbers
  1. echo substr(sprintf("%o",fileperms('../picture_library/floorplans/'.$id.'')),-4);
  2.  
and got 0777

ok so now i just ran

Expand|Select|Wrap|Line Numbers
  1. is_executable();
  2. is_readable();
  3. is_writeable();
  4.  
and apparently the file is readable and writeable HOWEVER it is not executable... how can that be if it says the permissions are 0777
Dec 31 '07 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($getID)){
  2.         $id=$row['id'];
  3.         $dir='../picture_library/floorplans/'.$id;
  4.         mkdir($dir,0777);
  5.         chmod($dir,0777);
  6.     }
  7.  
ok this is really starting to kill me... i've bee on this for an hour now surfing the net trying to find a solution. I am using a test server that i run on my computer to build sites and then upload (not sure if that will have any bearing).

anyway what im trying to do is OBVIOUSLY set permissions to this directory i just created BECAUSE... later on there is an option to delete...

Expand|Select|Wrap|Line Numbers
  1. unlink('../picture_library/floorplans/'.$id.'');
  2.  
however everytime i goto delete it says i don't have permissions... and clearly when i created the directory i set the permissions (at least im sure i did). Anyway any and all help would be had. Thanks guys.

i just tried this i dont know if it will help but i ran

Expand|Select|Wrap|Line Numbers
  1. echo substr(sprintf("%o",fileperms('../picture_library/floorplans/'.$id.'')),-4);
  2.  
and got 0777

ok so now i just ran

Expand|Select|Wrap|Line Numbers
  1. is_executable();
  2. is_readable();
  3. is_writeable();
  4.  
and apparently the file is readable and writeable HOWEVER it is not executable... how can that be if it says the permissions are 0777
files
When using unlink() the script that executes it must be in the same directory as the poor file being deleted.

directories
Try using rm_dir() to remove directories
:)
Dec 31 '07 #2

banning
P: 42
files
When using unlink() the script that executes it must be in the same directory as the poor file being deleted.

directories
Try using rm_dir() to remove directories
:)
LOL the poor file haha... thats good stuff... but rmdir(); only deletes a directory that is empty. However i have found a solution on another forum, i haven't tried it yet but i'll go ahead and post it.

Expand|Select|Wrap|Line Numbers
  1. function RecursiveFolderDelete ( $folderPath ){
  2.     if ( is_dir ( $folderPath ) ){
  3.         foreach ( scandir ( $folderPath )  as $value ){
  4.             if ( $value != "." && $value != ".." ){
  5.                 $value = $folderPath . "/" . $value;
  6.                 if ( is_dir ( $value ) ){
  7.                     FolderDelete ( $value );
  8.                 }elseif ( is_file ( $value ) ){
  9.                     @unlink ( $value );
  10.                 }
  11.             }
  12.         }
  13.         return rmdir ( $folderPath );
  14.     }else{
  15.         return FALSE;
  16.     }
  17. }
  18.  
Dec 31 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.