Ok, have tested this on two sites and I get the same problem.

I have enabled browse subfolders, Have created default subfolders all goes ok.
However, when I browse a sub-folder I get the absolute path to the folder rather than the relative .
ex.
configured path:
/files/userX/images /files/userX/pdf /files/userX/mp3

When I browse the subfolder I get the following, note it's the same for all paths configured.
/mounted-storage/home22a/sub001/xxxxxxxxx/xxxx/files/u52/images

If I select UP, ie, go up a folder the problem remains.

My guess is the problem is here somewhere:

function imce_relative_path($path, $root=NULL) {
  $abs = str_replace('\\', '/', realpath($path));
  $root = str_replace('\\', '/', ($root ? realpath($root) : $_SERVER['DOCUMENT_ROOT']));
  return strpos($abs, $root)===0 ? trim(substr($abs, strlen($root)), '/') : substr($abs, (($pos=strpos($abs, '/')) ? $pos : 0));
}

Hopefully this will be an easy fix?

regards,

Andy Ramblings

Comments

ufku’s picture

Andy Ramblings’s picture

Hiya,

I have tested the patch update that you published.
I replaced the two lines that have a + next to them, hence removing the lines with a -.

The problem is still present.

I have cleared my cache, uninstalled IMCE, re-installed IMCE. the problem still persists.

a Great module.

Kindest regards,

Andy

Bevan’s picture

I am getting this problem too. It's quite frustrating. As we have 100s of images and having them organised 'flatly' will make it difficult to find and retrieve them. I run the drupal instance through a couple of symlinks, could that be an additional cause to the bug?

And, are your sites running on symlinks or directly on the 'real' directory structure?

ufku’s picture

yes bevan you are right. with symlinks we need to get the real path. thanks for reminding it.
i updated the patch at http://drupal.org/node/110983.

Andy, if you already applied the old patch, just replace the expression
dirname($_SERVER['SCRIPT_FILENAME'])
with
dirname(realpath($_SERVER['SCRIPT_FILENAME']))

Bevan’s picture

That works great! When do you think there will be an official or dev release with that patch?

ufku’s picture

when i'm sure that the patch works for everyone having this problem, i'll commit it and mark this issue as fixed. Then, the development version will be including the fix.

Andy Ramblings’s picture

Good afternoon from London ;o)
Yep that last fix, fixed the problem at my end.

ufku, thanks for the work done, It's greatly appreciated.

Andy

ufku’s picture

Status: Active » Fixed

commited thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)