1

I need to change the field type "file" to "image" in drupal 7. I just hack the database and found a table named "field_config" and modified the "type" and "module" column, from "file" to "image". I found that it's works correctly.

My question is that, is this the correct way to change the "field type" of the field? Any better answer would be appreciated. Thanks in advance.

3

Drupal itself does not support changing the field type, only the widget. This is because different types have different database structure. On the other hand, it is possible to change some types with custom code (e.g. see http://www.up2technology.com/blog/converting-drupal-fields) but in general, you would need to write migration to do this.

So in general, it is not possible to change the field type without loosing the data stored in it, especially not things like text -> image etc.

| improve this answer | |

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.