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.

Some upload_preferences not loading

May 17, 2012 8:02pm

Subscribe [2]
  • #1 / May 17, 2012 8:02pm

    Supply

    18 posts

    HI ya,

    I’m having a strange issue where some settings in the upload_preferences config array are not applied.
    I am using the NSM bootstrap for my site config.

    Here is my upload_preferences declaration:

    'upload_preferences' => array(
       array(
        'name'=>'Tiles',
        'server_path'=> NSM_BASEPATH . '/uploads/tiles/',
        'url'=> NSM_SITE_URL . '/uploads/tiles/'
       ),
       array(
        'name'=>'Products',
        'server_path'=> NSM_BASEPATH . '/uploads/products/',
        'url'=> NSM_SITE_URL . '/uploads/products/'
       ),
       array(
        'name'=>'Files',
        'server_path'=> NSM_BASEPATH . '/uploads/files/',
        'url'=> NSM_SITE_URL . '/uploads/files/'
       ),
      ),

    in the CP the Products(id 1), Files(id 2) load fine - but Tiles(id 3) is not applied (database value is loaded).
    If I change the order of the array in upload_preferences, then all sorts of stuff goes wrong in the CP. for e.g. both Files & Tiles are labeled as Tiles.

    Is anyone else having issues like this?

    Cheers

  • #2 / May 18, 2012 4:31pm

    Kyle Cotter

    730 posts

    Hi Supply,

    It appears your syntax for the array isn’t complete.

    To set upload paths via config.php, you need to use the following syntax,

    $config['upload_preferences'] = array(
        1 => array(                                                            // ID of upload destination
            'name'        => 'Staging Image Uploads',                          // Display name in control panel
            'server_path' => '/home/user/example.com/staging/images/uploads/', // Server path to upload directory
            'url'         => 'http://staging.example.com/images/uploads/'      // URL of upload directory
        )
    );

    You haven’t passed an ID for the upload destination.

    Hopefully, once you do that, you’ll be up and running.

    So, something like,

    $config['upload_preferences'] = array(
        1 => array(                                                            // ID of upload destination
            'name'        => 'Products',                          // Display name in control panel
            'server_path' => NSM_BASEPATH . '/uploads/products/', // Server path to upload directory
            'url'         =>  NSM_SITE_URL . '/uploads/products/'      // URL of upload directory
        ),
        2 => array(                                                            // ID of upload destination
            'name'        => 'Files',                          // Display name in control panel
            'server_path' => NSM_BASEPATH . '/uploads/files/', // Server path to upload directory
            'url'         => NSM_SITE_URL . '/uploads/files/'      // URL of upload directory
        ),
        3 => array(                                                            // ID of upload destination
            'name'        => 'Tiles',                          // Display name in control panel
            'server_path' => NSM_BASEPATH . '/uploads/tiles/', // Server path to upload directory
            'url'         => NSM_SITE_URL . '/uploads/tiles/'      // URL of upload directory
        )  
    );

    Let me know if that fixes it.

    Thanks!

  • #3 / May 20, 2012 4:40pm

    Supply

    18 posts

    Hi Kyle,

    yes that’s fixed it, cheers.

  • #4 / May 22, 2012 12:08pm

    Kyle Cotter

    730 posts

    Hey Supply,

    Glad I was able to help!

    If you have any more questions, feel free to post again.

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases