Switch to full style
Dynamic open source server-side web development
Post a reply

File Permission

Tue Sep 06, 2011 1:23 pm

Detail program about File Permissions in PHP.
To control file permission in PHP you can use "chmod" function.
Code:

<?php
// Set  Permission  For Owner :Read and write.
// Everyone else : nothing
chmod("/directory/test.txt"0600);
// Set  Permission  For Owner :Read and write.
// Everyone else : read only
 
chmod("/directory/test.txt"0644);
// Set  Permission  For Owner :Everything .
// Everyone else : read and execute .

chmod("/directory/test.txt"0755);
// Set  Permission  For Owner :Everything .
// owner's group: read and execute.
// Everyone else :  nothing.
 
chmod("/directory/test.txt"0750);


// owner, group ,everyone else : read ,write execute.  
chmod("/directory/test.txt"0777);
?>


it is all about the code of permission
Code:
7       4      4
user   group  world
r+w+x    r      r
4+2+1  4+0+0  4+0+0  = 744




Post a reply
  Related Posts  to : File Permission
 Applet File Permission     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 Copy file to file in java code- implementation     -  
 getting file name of html input file tag using jsp     -  
 file descriptor vs file pointer     -  
 How to convert xml file to Pdf file using C     -  
 C++ File I/O     -  
 web.xml file     -  
 Create PNG file     -  
 File Upload in JSP     -  

Topic Tags

PHP Files and I/O