I've installed fileshare in drupal 5.1 using fileshare 5.x.1.x-dev

I had tested this on a test installation before exposing my users to it. It looked and worked fine in the test environment, but the production environment I'm getting some errors. When they go to edit a fileshare page these messages come up:

    * warning: readdir(): supplied argument is not a valid Directory resource in /var/www/vhosts/visforvoltage.net/httpdocs/modules/fileshare/fileshare.module on line 623.
    * warning: sort() expects parameter 1 to be array, null given in /var/www/vhosts/visforvoltage.net/httpdocs/modules/fileshare/fileshare.module on line 626.
    * warning: closedir(): supplied argument is not a valid Directory resource in /var/www/vhosts/visforvoltage.net/httpdocs/modules/fileshare/fileshare.module on line 685.

Then if I 'Submit' the fileshare page this message appears on an otherwise blank page

RENAMING ERROR - from "files/" to "files/Downloadable_E-max_Manuals_and_Diagrams461".

And this message appears in the log

warning: rename(files/,files/Downloadable_E-max_Manuals_and_Diagrams461): Invalid argument in /var/www/vhosts/visforvoltage.net/httpdocs/modules/fileshare/fileshare.module on line 284.

The files attached to the fileshare page as in they are in the "Upload New File" section of the edit page.

Comments

JamieR’s picture

The errors you are getting are related to the fileshare directory not being found. Perhaps durring the edit the filename is getting lost - it does the rename of the directory to match the fileshare name incase you change the node name... but I'm unable to duplicate the problem here... Any more details you can provide?

JamieR’s picture

Another thing to watch for is special characters in the file path...

gracearoha’s picture

Title: supplied argument is not a valid Directory resource » RENAMING ERROR - from "files/" to "files

I am also getting this renaming error. I am trying to set up the program so that if i enter a file in a group page, any of the other members can go into it and edit it. But when someone goes in to edit the file and then hits submit, a blank page with the Renaming Error appears. No one is changing the file path.

lluchjm’s picture

Hello,

I have the same "RENAMING ERROR" error when I create fileshare page.

I have tested this in a local Linux and in my webserver, and I obtain the same problem.

How did you resolve it?

Thanks

maciagt’s picture

Hello

I am getting this same error. After the upgrade to Drupal 5.1, on my previously made fileshares, it will not let me enter a "node base path". This is not visible. I can create new fileshares...this only applies to ones previously made before the upgrade. Any help would be most appreciated!!

Thanks (and I really do love the fileshare module!!)
Take care
Tim

Craig Gardner’s picture

I had come across this very same problem. Check out my patch at http://drupal.org/node/149628 for a possible fix.

Zefling’s picture

White this line the problem disappears :

In function fileshare_insert:

 if (!is_dir($node->_basepath.$node->_filepath)) {
    # Patch : begin
    $path_t = explode('/', $node->_basepath.$node->_filepath);
    $path = 'files';
    for($i=1; $i<count($path_t)-1; $i++) {
      $path .= '/'.$path_t[$i];
      if (!is_dir($path)) {
        if(!mkdir($path, 0777)) { // checks and writes directory
          die('DIRECTORY ERROR - please check that "'.$path.'" is the correct path and that it is writable by your the webserver.');
        }
      }
    }
    # Patch :End
    umask(0000);

In function fileshare_update:

    if ($node->_filepath != $rename) {
      # Patch : begin
      $path_t = explode('/', $node->_basepath.$node->_filepath);
      $path = 'files';
      for($i=1; $i<count($path_t)-1; $i++) {
        $path .= '/'.$path_t[$i];
        if (!is_dir($path)) {
          if(!mkdir($path, 0777)) { // checks and writes directory
            die('DIRECTORY ERROR - please check that "'.$path.'" is the correct path and that it is writable by your the webserver.');
          }
        }
      }  
     # Patch :End
      if (!rename($node->_basepath.$node->_filepath, $node->_basepath.$rename)) {
Zefling’s picture

A little correction. If the root of files is not "files/" :

      $path = '';
      for($i=0; $i<count($path_t)-1; $i++) {
        if(!empty($path)) $path .= '/';
        $path .= $path_t[$i];
lucas20’s picture

I tried Zeflings patch the first way and it gave me a RENAMING ERROR, if I try it the second way it is a DIRECTORY error - does anyone know what the difference between DIRECTORY and RENAMING and what a possible solution may be?