Finally got og_files installed, went to upload file and got this error:


    * warning: mkdir() expects at most 2 parameters, 3 given in /var/www/html/websites/drupal/test01/modules/og_files/og_files.module on line 192.
    * The selected file /tmp/tmp_PwzAtp could not be uploaded, because the destination is not properly configured.

Any suggestions?

Comments

pivica’s picture

I have just looked at section of code from line 192:

mkdir($path, 0777, true)

But that third parameter was added as of PHP 5.0.0. Maybe you are using PHP 4?

somebodysysop’s picture

Yes, I am using php 4. Is php 5 required?

pivica’s picture

Well yes, as I remember og_files have a strange approach when creating new directories - for example module will create dir only when you upload file in it and not before - so you create two dirs (second is in first) and dirs are not yet created on file system, then you upload file in second dir and only then og_files will first recursively create two dirs with mkdir (and that is that param 3 - true) and then upload file.

I agree this is not very intuitive and something user would not expect, but until that is changed you would have to switch to php 5 for this.

wundo’s picture

Status: Active » Closed (works as designed)

Yep, right now you *do* need PHP5, but as far as know PHP4 is already unsupported, so I would recommend you to upgrade as fast as possible. ;)

kdon’s picture

Issue summary: View changes

check this method instead


function checkPath($filePath, $permission = 0777) {
    $parts = array_filter(explode("/", $filePath));

    $rootPath = "";

    //removing file name from parts
    array_pop($parts);

    foreach ($parts as $path) {
        if (! file_exists($rootPath .= "/$path")) {
            if (! mkdir($rootPath, $permission)) {
                return false;
            }
            continue;
        }
    }
    
    return true;
}

you could test this via https://phpbox.info/19JsM