Support » Plugins » [nextgen-gallery] chmod uploaded files to 640

  • Hello,

    I have a problem with my hoster. All uploaded files get 600 instead of 640. So how can I make NextGen Gallery to chmod my uploaded files to 640?

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same problem. It’s annoying to chmod the uploaded files and the thumbnails by hand. FTP ist the only method to get the files uploaded correctly.

    Me too!
    Ruben, please help.
    The hosters Domaingo and Domainfactory have this problem (actually Domaingo is the low-cost-outlet of Domainfactory).
    Domainfactory as well as some other users provide some help to fix the default upload function of wordpress:

    Unfortunately this does not solve this issue for the nextgen gallery…

    Thank you for your efforts.

    Hmm, no reply at all?

    I found a small script which walks recursively through all subdirectories and sets the speciefied chmod.

    This is at least better than nothing…

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>CHMOD Scriptlet</title>
        <meta name="description" content="Wolfcast CHMOD Scriptlet Version 1.0">
        <meta name="author" content="Alexandre Valiquette (">
        <style type="text/css">
                width: 875px;
                height: 300px;
                overflow: auto;
                border: solid 1px black;
            div#logtext p
                white-space: nowrap;
                margin: 0px;
            div#logtext p.success
                color: #008000;
            div#logtext p.error
                color: #ff0000;
    <!-- START - PHP generated output -->
    //rChmod will recursively CHMOD $dir and it's content to $dirModes for directories and to $fileModes for files.
    //$dirModes and $fileModes must start with 0 (755 become 0755 for instance).
    //rChmod returns the number of failed CHMOD operations.
    function rChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 )
        $retval = 0; //Number of failed CHMOD operations
        echo "<p style=\"margin-bottom: 0px\"><b>Log:</b></p>\r\n<div id=\"logtext\">\r\n";
        $d = new RecursiveDirectoryIterator( $dir );
        foreach ( new RecursiveIteratorIterator( $d, 1 ) as $path )
            $chmodret = false;
            if ( $path->isDir() )
                $chmodret = chmod( $path, $dirModes );
                if ( is_file( $path ) )
                    $chmodret = chmod( $path, $fileModes );
            if ($chmodret)
                $pclassname = "success";
                $pclassname = "error";
            echo "<p class=\"" . $pclassname . "\">" . $path . "</p>\r\n";
        echo "</div>\r\n";
        return $retval;
    //Change the following line to fit your needs (path, directories CHMOD value, files CHMOD value). CHMOD values must start with 0.
    $nbfailed = rChmod( "/[ENTER FULL PATH HERE]/", 0755, 0644 );
    echo "<p style=\"margin-top: 0px\"><b>";
    if ($nbfailed > 0)
        echo $nbfailed . " CHMOD operation(s) failed! See log above.";
        echo "No error encountered.";
    echo "</b></p>\r\n";
    <!-- END - PHP generated output -->
        <img src="" alt="Valid HTML 4.01 Strict" height="31" width="88">

    do you fix your problem ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[nextgen-gallery] chmod uploaded files to 640’ is closed to new replies.