Assigning and return octal number?

Discussion in 'PHP' started by SGBoise, Dec 10, 2008.

  1. #1
    Hey Guys,

    I hope you guys can help me. I am trying to create a variable that will hold the default file permission for the chmod.

    For example:

    $chmod_perm = 0755;

    $chmod($file, $chmod_perm);

    My problem is that $chmod_perm becomes a long type and the number changes. I also tried using decoct() but just returns 755. Chmod requires the parameter to be 0755 or else it doesn't work.

    Thanks in advance.
     
    SGBoise, Dec 10, 2008 IP
  2. SISKO

    SISKO Peon

    Messages:
    9
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    assuming that i understood what your problem is, $chmod_perm = '0755'; should work
     
    SISKO, Dec 11, 2008 IP
  3. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    :(Unfortunately that doesn't work. It can't be a string value. It must be numerical.
     
    SGBoise, Dec 11, 2008 IP
  4. brownskinman

    brownskinman Peon

    Messages:
    18
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    A bit overkill but solves your tricky problem :confused:
    <?php
    // ftp connect....
    $chmod_perm = '0755';
    $file_path = '/uploads/';
    ftp_site($ftpconn, "CHMOD {$chmod_perm} {$file_path}");
    ?>
    PHP:
     
    brownskinman, Dec 11, 2008 IP
    SGBoise likes this.
  5. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'll just stick with specifying it manually. I figured someone would had a solution for this.

    Thanks guys.
     
    SGBoise, Dec 11, 2008 IP