4

In Brief

How can I convert a file fieldtype back to a text input field containing {filedir}filename?

The long-winded version

I have a file field that I converted from an input field when I was first moving to EE2 and was trying things out. The input field was just the url of the file on the server, so something like {filedir_11}filename_here

I don't use any special features of the file fieldtype, and only use the file url as output. There are other input fields used for file urls in this field group that have not been converted, and for those I can use text expander shortcuts to make my life easier, but for the one that is a file type field I have to mouse around and it slows things down for no benefit.

What I would like to figure out how to do is convert the file field back into a text input field and make sure that the field contains {filedir}filename. I'm not shy about running database queries to accomplish this, but I'm not currently familiar enough with how the file fieldtype works to feel confident in trying it, so I'm hoping someone can save me some time.

1 Answer 1

5

How can I convert a file fieldtype back to a text input field containing {filedir}filename?

You can actually just edit the custom field in the Control Panel, changing it from File to Text Input, and you're set. There aren't any further steps needed. The custom field will still contain the same data it did when it was a File fieldtype. Content like {filedir_1}some_file_name.jpg will remain intact in exp_channel_data after you have changed a field from File to Text Input.

Always good to backup your database before making a change like this, though.

1
  • Alex, you are both right, and my favorite person of the day so far. Thanks :)
    – UltraBob
    Dec 10, 2012 at 7:05

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.