SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast rusagar's Avatar
    Join Date
    Jan 2007
    Location
    Kathmandu, Nepal
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CHMOD ...read write execution permissions

    How can i give a write permission to the folder and its contents in PHP.

    Let me illustrate with an example -
    I have a root folder name "Root", I set up write permission to this folder.
    FIRST :
    Now I have to create new folder with write permission on it. I m able to create the folder but it doesn't have write permission

    SECOND :
    I need to upload the pictures on those newly created folder. These pictures should also need to have write and execution permissions but I m unable to do so.

    Can anyone help me??
    Thanks in advance

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all if you are on the Windows server and there is no meaning of changing permission of the directory (called folder in windows). And of course if you are in the same *NIX system, then you have to give file permission for each directory or file.

    From PHP there is function chmod() (I think you are well known about it) which takes two parameters first is the chmoding directory/file name and second is the generally a 4 digits of group of numbers with prefixing zeros.

    PHP Code:
    $directory "path/to/the/directory"// or path/to/the/directory/and/file
    chmod($directory0777); 
    Of course each subdirectories are to have permission to read/write. So be sure that you have used the same case, because all *NIX servers hang on case sensitive.

    Don't forget to prefix the 0 if the normal 3 digits does not work at all.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •