473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mkdir permissions help

banning
42 New Member
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 1450
Markus
6,050 Recognized Expert Expert
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 New Member
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

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

Similar topics

2
1748
by: Shaun | last post by:
Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir("/test/"a) the last line does not seem to work. os.mkdir(a) makes the directory
1
1681
by: joelbyrd | last post by:
I'm trying to do a mkdir(), but I'm getting permission denied error, even though I've set the mode to 0777: mkdir($full_path, 0777). I also couldn't do a chmod successfully. The code is something like: mkdir("/home/httpd/vhosts/website.com/httpdocs/dev1/test_folder1", 0777); What's the problem?
5
9255
by: eoindeb | last post by:
I am trying to create a directory on Solaris using the mkdir() function. This works fine when I pass a string literal ("/etc/hosts") to mkdir, but if I try passing a directory pointer to mkdir, it returns a -1 error. The directory error works fine with fopen - does anyone know what I am doing wrong?? Here's a snippet of the code: int...
30
7666
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the target directory (where the backup copies will be kept, on another drive). I can successfully test whether the target directory exists or not using...
8
24504
by: vj | last post by:
How do I do the following unix command: mkdir -m770 test with the os.mkdir command. Using os.mkdir(mode=0770) ends with the incorrect permissions. Thanks, VJ
1
1888
by: B | last post by:
Hi, I am using mkdir to create a directory and upload files to it. Unfortunately the folder is accessible via the url to any user, which is creating problems. How can I manage permissions with mkdir so the folder is not availabe via the url path thanks :)
3
1689
by: fouadk | last post by:
hi everyone.... i am trying to create a folder in my home directory but that ain't working due to permission restriction my code looks like the following: <?php $path = "/home/fouad/testing"; if(mkdir($path,700,TRUE)) {print "success."; }else {print "failure.";} ?>
1
4451
Icecrack
by: Icecrack | last post by:
Good day/night, Im creating a script that creates a folder and moves files inside that folder, the only problem i'm having is when creating the folder if it does not exist, i have tried different methods, mainly come up with permissions denied. codes i have used:
2
4487
by: ezechiel | last post by:
Hi, I'm working on windows here.. i have a script that makes directories, subdirs (mkdir) and I afterwards set special permissions with xcacls trough a system call. But when I took a closer look at the advanced security permissions, I saw that mkdir makes permission inheritance, when creating the subdirectories: main dir is ok, but sub...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.