469,275 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

mkdir permissions help

banning
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
2 1325
Markus
6,050 Expert 4TB
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
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.

Similar topics

1 post views Thread by joelbyrd | last post: by
5 posts views Thread by eoindeb | last post: by
30 posts views Thread by MikeC | last post: by
8 posts views Thread by vj | last post: by
1 post views Thread by B | last post: by
3 posts views Thread by fouadk | last post: by
Icecrack
1 post views Thread by Icecrack | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.