Hello, I am using IMCE along with WYSIWYG. I'm unfortunately stuck using IIS7 as opposed to Apache.

I have uploaded a folder full of images so that content managers can attach them to articles/blogs using IMCE to browse the network.

They are able to browse to the folder, but the folder displays empty. If they use IMCE to upload images from their local hard drives, 'those' images are browsable.

my first thought was that maybe it is a file permissions issue. To troubleshoot, I uploaded a random image to the library folder using IMCE to browse my hard drive. Next, I copied the file permissions from that uploaded file and applied/recursed them to my image directory.

upon creating a new article, I used IMCE to browse the server. Of course the IMCE uploaded files are browsable, but still no go on my image library folder. All folders display, but they are empty.

When you upload a file via IMCE, does it add that filename to some special database or something? Why will it only list files that were specifically uploaded using its interface?

Any thoughts?

Comments

bhosmer’s picture

Who is the owner of the file on your server? If I remember properly, files added by IMCE are owned by a process, like 99 or 731 whereas files manually added are owned by the user, like "admin".

Maybe this is the issue with your permissions. You might have the permissions set correctly in IMCE, but everyone accessing the file using the drupal interface, IMCE, are seen as one single user by your server.

Find the file you can't view with IMCE and see who the owner is using ssh or an FTP program. Then find a file you can see using IMCE and see who the owner of that file is.

I suspect they might be two different owners.

nuthman’s picture

Hmm.. Interesting, I think I saw before that the owner was iis_usr, but I'll check again. Thanks!

nuthman’s picture

unfortunately, the owner is iusr.. I already tried changing the owners of the other files to iusr, but it's not working.. man this is depressing hehe..

nuthman’s picture

I just discovered something strange.. When I use the IMCE plugin for WYSIWYG (TinyMCE), ie I click 'browse' after clicking the insert/edit image button inside the TinyMCE body area, I can see all of the files.

Now, when I use IMCE to browse using a custom CCK filefield, that is when I can only see files that were uploaded via IMCE. Does that turn on any mental lights?

nuthman’s picture

The culprit was in imce.inc in the filefield_sources module.

// Get the default IMCE directory scan, then filter down to database files.
  $directory = imce_scan_directory($dirname);
  foreach ($directory['files'] as $filename => $file) {
  //  if (!isset($db_files[$filename])) {
   //   unset($directory['files'][$filename]);
   //   $directory['dirsize'] -= $file['size'];
  //  }
  }

after commenting out the if block, it no longer removes files from the directory listing. I don't really understand this behavior.. How to I add files to the IMCE database without manually uploading each file?

bhosmer’s picture

Maybe a mass chown for the files you manually added? Does this make them visible in IMCE?

nuthman’s picture

Well, it turns out that it's not an ownership problem at all.. it's a 'not in the database' problem.. But as I mentioned in an earlier post, it only seems to affect files that I manually uploaded, and am attempting to list using IMCE via file sources.. It works fine with those SAME files when I use IMCE via TinyMCE.. Here are screenshots of what I mean:

Working screenshot
problem screenshot

Look at the first, then the second. I can't figure out what I am doing wrong.. Maybe I should report this as a bug to File Sources?

bhosmer’s picture

I'm certainly not an expert with IMCE or TinyMCE. Your hypothesis makes sense - if there isn't a record in the database then Drupal and its ilk might have no idea it is there. I do know that the WYSIWYG editor create some entries in /files sometimes that are derivatives of the original files. Maybe an bug report might clear this up.

I have manually added files by FTP and had them visible using IMCE and CKEDITOR so it does work. I'm just not sure about your situation.

nuthman’s picture

I finally managed to get it working by hacking the filefield sources module

Details here: http://drupal.org/node/436182#comment-3570252

BioALIEN’s picture

I don't advise you to hack contrib modules. To achieve what you need, you can use the IMCE FileField module: http://drupal.org/project/imce_filefield

navoff’s picture

Tried that. I can see the folders but I'm not seeing the files in the folders. There are a total of 15 .png files, 1 .jpg and 3 .gif files. All I can see are the 1 .jpg and 3 of the .png files. It's obviously not a permissions issue since I can see the files fine if I use the image button to access the browser via the CKEditor. It's just trying to use IMCE file browser in conjunction with the Insert module that I seem to have problems. The only visible images are those that I used the Insert Module to upload. All the images uploaded inline via the CKEditor or that were uploaded to the theme (i.e. the logo) aren't visible.

vegantriathlete’s picture

I believe your problem is that when you manually upload images, they won't appear in the files table in the Drupal database. Thus, IMCE won't see them. filefield_sources is the module that is intended to allow you to pull files from some location on your server into Drupal's database.

So, you either need to upload the image first or you need to use filefield_sources first. I don't believe you are experiencing a bug, I believe you are experiencing the intended behavior.