0

I have a problem that I can't access public files directory from IMCE as file browser (and CKEDITOR as editor). When an user write a blog post, he can't upload images to public directory because this path doesn't appear in the IMCE directory tree.
Prior to post this question I have searched in Drupal Answers, in Drupal forum and in Google if there is an answer to my question but without success. I've read some other answer to similar questions but without success. I put here my configuration.

Config media file system:

  • Public path: sites/default/files
  • Private path: sites/default/files/private
  • Temp path: tmp
  • Checked: Private files served by Drupal

CKEditor file explorer: IMCE (for all)

Users, that can write blog post, has permission to "Bypass file access control", "Administer files", "add and upload new files", etc.

When they write a blog post and open IMCE to upload an image in the body, the paths shown in the directory tree are all relative to private directory and they can't select public path.
It's for Drupal 7.

How should I do to allow user to upload files to public path with IMCE?

UPDATE
After some days searching about this question, I have found where is the problem. There are two, very old, open issues in IMCE that are just my problem. https://www.drupal.org/project/imce/issues/2018863 https://www.drupal.org/project/imce/issues/1700438
CKEditor launch IMCE according to the method you have selected to download files in Admin > Configuration > Media > File system, under the "Default download method". If you select private download then CKEditor always open IMCE in private folder and then you can't switch to public folder, despite of the new node will be public (blog post).
I think it's a very big problem. I should have the option to select if I want public or private directory in IMCE when It was launched by CKEditor.

2 Answers 2

1

Chances are you haven't set filebrowser permissions within the IMCE config page.

  1. Go to Configuration > Media > IMCE

  2. Setup/confirm the IMCE Profile for filebrowsing. NOTE: IMCE has its own "profiles" which can be used as roles specific to the filebrowser functionality. The default User-1 role has the ability to see all files/folders. If you need more granular access to subfolders/specific folders within the files directory, setup a new profile.

  3. Check that your blogger/blog contributor role has a profile assigned in Public Files column (and if necessary, private files column).

IMCE Config Page


In addition to checking the IMCE filebrowser permissions, you'll want to check the individual field settings. It can only be set to save/upload to either Drupal's public files directory or private files directory. It doesn't allow content managers to choose which directory to upload/save to at time of upload/per piece of content.

File or Image Upload Destination Config

3
  • Thanks for your help but I knew this configuration options and I have put it before I posted the question. I have the configuration as you said.
    – briast
    Jan 31, 2018 at 18:14
  • In order to show files in the public path, the field itself may need to be set to store uploaded files in the public files directory. I've added a screenshot of that to my answer. Note: if this solves the issue moving forward, you'll need to determine if your legacy files previously uploaded in private upload directory should be visible in public upload directory for future selection. Feb 1, 2018 at 1:24
  • Thanks again for your support. I'm sorry but this is not the problem. As I wrote in the question, the problem is when CKEditor launch IMCE it always goes to private directory in spite of the content type is public. It isn't a problem with file fields.
    – briast
    Feb 1, 2018 at 7:28
0

It would be helpful to provide information on which Drupal Version you are working with and what editor related modules are activated. In Drupal 8 the ckeditor module is activated as part of core. IMCE can be added (and used to browse files) as a contributed module. The comments provided by Drupal for the settings php file indicate that you need to set the private path outside Drupal site path (i.e., not in sites/default/files).

From settings ...

  • A local file system path where private files will be stored. This directory must be absolute, outside of the Drupal installation directory > and not accessible over the web.

In Drupal 8 there is a separate configuration step for IMCE (admin/config/media/imce that lets you set folder paths for an admin profile and a member profile. Maybe you have something set in your member profile that's directing them the so-called private path?

I'd would recommend checking out the folder path settings in IMCE and maybe eliminating the private path settings in settings.php entirely. Also, see if an admin can create a blog post and put the image in the public directory. And clarify what Drupal version you are using.

1
  • I'm sorry. It was my fault. It's for Drupal 7.
    – briast
    Jan 22, 2018 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.