I've upgraded my site from D6 to D7. IMCE worked fine in D6.
I'm using IMCE with FileField Sources for an image field. I've set up IMCE to show a specific directory under sites/default/files, same directory is set up in FileField Sources. When it opens, it doesn't show any files, even though I can see these files in files table in the database. What's missing here?

When I'm trying to upload a file, the upload hangs. The file is actually uploaded to the directory and shows up in IMCE windows, but when I click on it, I get a message "The selected file could not be used because the file does not exist in the database." Opening IMCE again, I don't see this file. Obviously it's never recorded in the database.

I don't see any PHP errors but I've noticed two Javascript errors, not sure if they're related:
Error: $ is undefined
Source File: https://www.nestanet.org/test/file/imce/node/newsletter_corner
/field_imceimage?app=Image%7Curl%40edit-field-imceimage-und-0-imce-path
Line: 49
Error: imce.el("file-count") is null
Source File: https://www.nestanet.org/test/sites/all/modules/imce/js/imce.js?lqsv55
Line: 644

Comments

julia_g’s picture

OK, I've traced files not showing up to my template problem. It's now showing up the files I've uploaded. But when I try to choose one for the image field, I still get a message "The selected file could not be used because the file does not exist in the database."

I've traced this to the following code in filefield_source_imce_value:

$fid = db_select('file_managed', 'f')
->condition('uri', rawurldecode($uri))
->fields('f', array('fid'))
->execute()
->fetchField();

URI in the database starts with public://, but $uri has a full path: /mydrupaldir/sites/default/files/ . Not sure if this is IMCE or Filefield Sources issue.

ufku’s picture

Status: Active » Closed (works as designed)
julia_g’s picture

I've already applied it a while ago, didn't help.