I have a single drupal installation running two different sites. This is done by making a seperate folder in the sites folder for each domain and putting in a settings.php file. IMCE no longer works with a multisite setup. The browse icon is present but when I click on it the window pops up and I get "Directory Error!".

This installation of IMCE was working before I converted to a multisite setup, and it still works on other installation I have that are not multisite.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ufku’s picture

is your file system path writable by php. check it at admin/settings under file system settings.

tbartels’s picture

Yes, I was using it successfully as a single instance install prior to encountering this.

permissions are:
drwxrwxrwx 3 root www 4096 Oct 4 15:46 files

mr700’s picture

Status: Active » Needs review
FileSize
1.21 KB

I'm working with 4.7.x and multisite configuration too (one active site for now). My tinymce and imce are in drupal/sites/site.name/modules and the site is in subfolder (ex: http://localhost/drupal/). 'Hacking' imce_set.js a bit helped: I changed

  var imcePopup = window.open(tinyMCE.baseURL.substring(0, tinyMCE.baseURL.indexOf('modules')) 'index.php?q=imce/browse', '', 'width=560, height=440, resize=0');

to

  var sitebase = tinyMCE.baseURL.substring(0, tinyMCE.baseURL.indexOf('/sites/'));
  var imcePopup = window.open(sitebase + '/?q=imce/browse', '', 'width=560, height=440, resize=0');

which obviously will not work if you installed tinymce in drupal/modules. Maybe checking for '/modules/' and checking which one exists could solve the problem for everyone, like this:

  var sitebase = '';
  var idx_sites = tinyMCE.baseURL.indexOf('/sites/');
  var idx_modules = tinyMCE.baseURL.indexOf('/modules/');
  if (idx_sites != -1) { // .../sites/my.site/modules/...
    sitebase = tinyMCE.baseURL.substring(0, idx_sites);
  } else if (idx_modules != -1) { // .../modules/...
    sitebase = tinyMCE.baseURL.substring(0, idx_modules);
  } else {
    alert('Can not detect site base url');
  }
  var imcePopup = window.open(sitebase + '/?q=imce/browse', '', 'width=560, height=440, resize=0');

I'm attaching a patch for the last one.

ufku’s picture

thank you for the patch. i think getting the right url with javascript for all configurations is not possible since one may setup drupal under sub directories like domain.com/modules or domain.com/sites. that's why searching for these words is not sufficient. i think this URL thing should be set by php. may be a javascript variable refering to url('imce/browse'). i'll look into this.
thanks again.

ufku’s picture

FileSize
892 bytes

here is the module patch to use with the imce_set.js patch below.

ufku’s picture

FileSize
919 bytes

here is the imce_set.js patch to use with imce.module patch

mr700’s picture

Yep, with these two patches it works for me.

ufku’s picture

Version: master » 4.7.x-1.x-dev
Component: User interface » Code
Status: Needs review » Fixed

and as far as i tested it works with different multi-site configurations.
commited.

Anonymous’s picture

Status: Fixed » Closed (fixed)