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.

Advice on fieldtypes - file upload fields when upgrading to 2.x

July 30, 2010 12:57pm

Subscribe [24]
  • #1 / Jul 30, 2010 12:57pm

    Justin Kuntz

    41 posts

    I am looking for some advice/help when updating from 1.x to 2.x with some extensions. They are disabled in the process, but then I am looking for the best way to deal with fields such as the file upload field where I once used the nGen file upload extension and it’s now the native ee file field.

    I updated a site from 1.6.9 build 20100430 to 2.1.0 build 20100720. I disabled extensions and then once the update was complete, went back into each field group and changed the fields formally nGen field to File fields. And all my image paths are gone. Should I change each nGen file field to an input field before I upgrade?

    I am getting this error when I go to the page or try to edit a channel entry:
    Unable to load requested field type file:  ft.ngen_file_field.php.
    Confirm the fieldtype file is located in the expressionengine/third_party/ directory

    Although I have deleted all the old extension references from the exp_extensions table. There is one field is this field group with a file upload type and I have deleted it and added it again and it’s still gives me the error.

    So I guess I have 2 questions: any advice on upgrading with different fieldtypes? And any advice on tracing this error?

    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Jul 30, 2010 1:20pm

    Justin Kuntz

    41 posts

    Fixed the error, I had a rouge nGen file upload field in a Matrix that I missed. I changed it to a File field and the error is gone. However, the those fields are now blank instead of filled with image paths.

  • #3 / Jul 30, 2010 3:32pm

    Ingmar

    29245 posts

    But they do take a value if you enter the correct one?

  • #4 / Jul 30, 2010 3:41pm

    Justin Kuntz

    41 posts

    Yes, I just have to go through and choose each file again. I am in the process of updating another site and changed all the nGen file fields to text input and we’ll see if that works.

  • #5 / Jul 30, 2010 3:47pm

    Ingmar

    29245 posts

    Very good. Let us know how it goes, please.

  • #6 / Jul 30, 2010 6:40pm

    Justin Kuntz

    41 posts

    No go. It loses the file upload path. So it’s example.jpg instead of https://ellislab.com/asset/images/team-photo/example.jpg

    I will have to go back through each entry and choose the images again. Yuck.

    If anyone has any ideas on how to avoid this, please let me know, thanks.

  • #7 / Jul 31, 2010 3:52pm

    Greg Salt

    3988 posts

    Hi Justin,

    I think that the best thing is to post in the CodeShare Corner forum so that you can get some community input into this. I can move this thread over there for you if you’d prefer.

    Cheers

    Greg

  • #8 / Jul 31, 2010 3:56pm

    Justin Kuntz

    41 posts

    Moving the thread would be good. Thanks!

  • #9 / Jul 31, 2010 4:01pm

    Justin Kuntz

    41 posts

    I realize this deals with an extension, however it seems strange that EE doesn’t have any guidelines or best practices for updating to ee2 with file upload fields, which I wager are utilized on pretty much every ee site. Thanks.

  • #10 / Aug 06, 2010 6:59pm

    gaarmaster

    39 posts

    Hey Justin, did you ever get anywhere with this? I’m facing the same issue. The only solution I’ve come up with so far is creating global variables for each of the upload directories and appending them to any field reference in my templates. In addition, I’ve created a new file field that will eventually replace the old one.

    So it’d look something like this:

    {exp:channel:entries channel="news"}
      {if old_file_field!='' AND new_file_field==''}https://ellislab.com/asset/images/team-photo/{old_file_field}{/if}
      {if new_file_field}{new_file_field}{/if}
    {/exp:channel:entries}

    Not exactly elegant (or time-saving), but at least this way I can re-upload the images at my leisure and slowly phase out the old field. I’m also using the publish layouts to hide the old fields from users.

  • #11 / Aug 06, 2010 8:21pm

    Rob Sanchez

    335 posts

    If you’re not afraid of some SQL, and after you’ve backed up your DB,

    UPDATE exp_channel_data
    SET field_id_XX = CONCAT('{filedir_YY}', field_id_XX)
    WHERE field_id_XX != ''
    AND field_id_XX NOT LIKE '{filedir_%'

    Swap out XX for your file field ID and swap out YY for your file upload location ID.

  • #12 / Aug 08, 2010 5:28am

    gaarmaster

    39 posts

    MUCH better! Thank you for the suggestion, that did the trick.  😊

  • #13 / Aug 17, 2010 1:44am

    Justin Kuntz

    41 posts

    sweet Rob, thanks! Should shave some time.

  • #14 / Aug 27, 2010 8:18pm

    Adam Stoddard

    27 posts

    Rob Sanchez, you’re my hero.

    I had been putting off updating an image heavy site to EE2 for a while now, as I discovered this issue when I updated my portfolio site.  There weren’t as many images, so it wasn’t a big deal, but this would have taken days.

    I had to updated a file field inside of a Matrix, and modified the query like so:

    UPDATE exp_matrix_data
    SET col_id_XX = CONCAT('{filedir_YY}', col_id_XX)
    WHERE col_id_XX != ''
    AND col_id_XX NOT LIKE '{filedir_%'

    The col_id_XX is the Matrix cell you want to update.

  • #15 / Sep 03, 2010 10:59am

    Kevin Miller

    11 posts

    Excellent stuff. That SQL will do the trick when looking to re-acquaint your filenames with their upload folder locations. Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases