1

I have been using public file system has the upload destination for file field. I want to change public file system into private file system. I cannot change it it showing below error.

There is data for this field in the database. The field settings can no longer be changed.

I cannot select the upload destination. How to change the file system for file field in drupal 8

5

I have no idea why the UI prevents from doing that. It's not actually anything in the storage, it's just the default for new files.

What you need to do is edit the config file directly, which is named field.field.$entity_type_id.$bundle.$field_name, for example field.field.node.article.field_image.

You can do that using drush cedit, or single export and then import it again from the UI, or do a full config export and import it again after changing that file.

| improve this answer | |
  • Disclaimer: Note that this is not possible for everything, some changes are not allowed for a reason. Changing the size of a textfield for example can't be done as Drupal has no mechanism to update the table in the database if you have data. – Berdir Oct 12 '16 at 18:25
  • Still works fine. But seems this now needs to be done inside field.storage.node.field_file.yml. uri_scheme: public must be replaced by uri_scheme: private, then config import, and it starts to work for all from now on added files, not for existing files. – leymannx Jul 9 '18 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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