ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Upgrade Text input field to a File field in 2.7

September 03, 2013 8:24pm

Subscribe [2]
  • #1 / Sep 03, 2013 8:24pm

    Sammi

    8 posts

    Hi,

    I am upgrading an old site where I have a lot of Text input fields with file references like this one:

    https://ellislab.com/asset/images/ent-partner-logo/SomeDocument.pdf

    No I want to upgrade this field to become a File field instead.  Should it be as simple as changing the field type?  Should it work if I already have an upload destination for filedir_2?

    I tried but it didn’t really work. Any recommendations?

    Best,
    Sammi

  • #2 / Sep 04, 2013 4:34am

    Bhashkar Yadav

    727 posts

    Hi Sammi,

    It would be possible with some program and SQLs. You can have following steps.

    - Make a file upload directory and put all those files within this directory.
    - EE stores the uploaded files data with database table “exp_files” so you will need to write a program which will traverse all the files of that directory and insert within the database table “exp_files”.
    - You will need to write a SQL which would update that text input field column within database table “exp_channel_data” so that http://ellislab.com/asset/images/ent-partner-logo/SomeDocument.pdf be updated with {filedir_x}SomeDocument.pdf
    - Now change that text input field type to file field type.

    I am not fully sure if you are getting this approach but hope it would work for you.

    Please share your further findings on it.

  • #3 / Sep 04, 2013 6:03am

    Sammi

    8 posts

    Hi,

    thank you. 

    I can see that the forum code actually replaced (filedir_2) in my previous post with http://ellislab.com/asset/images/ent-partner-logo/ 😊

    My data is already formatted like {filedir_x}SomeDocument.pdf

    That should the simplify my process.

    Best,
    Sammi

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases