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]
  • #31 / Mar 23, 2011 11:35am

    Alex Kendrick

    203 posts

    Thanks for sharing the thumbnail generation script, Rob! Very handy.

  • #32 / Mar 29, 2011 11:13pm

    David Lawrence

    41 posts

    I’m also getting this error:

    An Error Was Encountered
    Unable to load requested field type file: ft.ngen_file_field.php.
    Confirm the fieldtype file is located in the expressionengine/third_party/ directory

    I tried changing the matrix column with the nGen File Field to the native File type but I still get this error when I update.

    What am I doing wrong here and how can I fix?

    Thanks!

  • #33 / Apr 07, 2011 3:19am

    David Lawrence

    41 posts

    OK, figured it out! (last week actually but wanted to share here for others who wind up in this situation.)

    Examining the DB with Sequel Pro, I found the exp_fieldtypes table had a field with the name “nGen File Field”. This was throwing things off. I renamed the field “file” and that took care of the error.

    I Installed Safecracker, then ran Adam Stoddard’s version of Rob Sanchez’s SQL query. Voila! all the images reconnected perfectly.

    I just ran the PHP thumbnail script and everything is now back exactly as it was in 1.7.0. This is ten years of images (not as many as that may seem but still a lot).

    Very happy to have found a complete solution to the nGen upgrade problem.

    Rob Sanchez and Adam Stoddard - Thank you!!!

  • #34 / Apr 07, 2011 5:57am

    Sean C. Smith

    3818 posts

    Just realized I hadn’t linked to my blog post on this topic.

  • #35 / Jun 01, 2011 2:36am

    ipixel (Australia)

    158 posts

    Hey Rob,

    Any idea why I would be getting the following error when trying to generate the thumbs using your PHP script?

    A PHP Error was encountered
    
    Severity: Warning
    
    Message: Invalid argument supplied for foreach()
    
    Filename: libraries/Functions.php(650) : eval()'d code
    
    Line Number: 12

    This is the template code I’m using:

    <?php
    /* WARNING */
    //if you have a large number of files here
    //you may run into PHP max_execution_time or memory_limit errors
    
    //change this to the full server path to your upload directory WITH trailing slash
    $server_path = '/Users/brendanu/Sites/example.com.au/images/main/';
    
    $this->EE->load->helper('file');
    $this->EE->load->library('filemanager');
    
    foreach (get_filenames($server_path) as $name)
    {
        if ( ! file_exists($server_path.'_thumbs/thumb_'.$name))
        {
            $this->EE->filemanager->create_thumb(
                array('server_path' => $server_path),
                array('name' => $name)
            );
        }
    }
    
    echo 'FINISHED THUMB CREATION';
    
    ?>

    Note that the PHP set to parse on Output (tried on Input, same error returned).

    The SQL help on this thread is bloody marvellous, thanks to the pioneers.

    Cheers
    Brendan

  • #36 / Jun 01, 2011 11:03am

    Rob Sanchez

    335 posts

    Hm. It looks like get_filenames($server_path) is not returning an array. Maybe check permissions on your server path?

  • #37 / Jun 01, 2011 11:16am

    Thoughtful Web

    6 posts

    Brendan,

    I’ve just tried to implement Rob’s script and hit the same problem, but it was easily fixed in my case as my server path was incorrect. So double-check that first.

    BTW, the script worked a treat – thanks Rob.

    Simon

  • #38 / Jun 01, 2011 10:47pm

    ipixel (Australia)

    158 posts

    Yep, derp!

    Had the incorrect server path…I had changed it slightly since the install. Top work as usual Rob.

    Cheers
    Brendan

  • #39 / Jun 30, 2011 9:08am

    Etheya

    213 posts

    Okay im struggling to get my head around this one… so better to ask..

    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_%'

    So do i need to run this for each section? bit confused where to find the field_id in the tables too.. i can see certain fields, but having come this far dont want to mess up.. 😊

  • #40 / Jun 30, 2011 10:05am

    Etheya

    213 posts

    Hmmm im getting an error when i try and run this..

    Parse error: syntax error, unexpected T_STRING in /Users/briancoult/Sites/alexhare/manage/expressionengine/libraries/Functions.php(656) : eval()‘d code on line 3

  • #41 / Jun 30, 2011 10:13am

    Etheya

    213 posts

    Forget last… im officially a D**KH**D! for some stupid reason beknown to me i was dropping this code in a template, not in the SequelPro… thats it, need a coffee!!!

  • #42 / Jun 30, 2011 9:19pm

    ipixel (Australia)

    158 posts

    And you can find out the field ID’s in the control panel as they appear in the URL when editing the custom field (or as you hover over the link to edit the field in the custom field group listing).

  • #43 / Jul 01, 2011 3:13am

    Etheya

    213 posts

    Yeah not sure what i was thinking of yesterday… all well now 😊

  • #44 / Aug 19, 2011 5:45pm

    scottmey

    15 posts

    How do I run the php script? New to this… having a bit of a time with this upgrade, but this is my last step : )

  • #45 / Aug 21, 2011 3:41pm

    22aenily

    1 posts

    Nothing helped until I found this. Thank you

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

ExpressionEngine News!

#eecms, #events, #releases