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.

config upload_preferences array creates only one directory

October 21, 2012 1:04am

Subscribe [2]
  • #1 / Oct 21, 2012 1:04am

    jorgepinon

    11 posts

    Trying to pre-configure file upload directories in my config file (suggested in the docs) but only the first item in the array appears in the CP.

    Is this a limitation? I guess I can live with creating the second entry in the CP as long as it’s always overwritten by the config file.  But maybe there’s something I’m doing wrong.


    This is the array in my config file:

    $config['upload_preferences'] = array(
        1 => array(
            'name'        => 'work images',
            'server_path' => $config['server_path'].'/images/work/',
            'url'         => $config['site_url'].'/images/work/'
        ),
        2 => array(
            'name'        => 'photos',
            'server_path' => $config['server_path'].'/images/photos/',
            'url'         => $config['site_url'].'/images/photos/'
        )
    );
  • #2 / Oct 21, 2012 1:09am

    jorgepinon

    11 posts

    The page in the doc says this:

    Each key in the array is optional and only overrides existing values in the database, new upload destinations cannot be created using this configuration variable.

    I’m assuming that “new upload destinations cannot be created” means that the directories themselves have to be created.

    But the first part of that tells me that new entries in CP/file_upload_preferences have to be created in the CP first. Which makes sense I guess, but would love confirmation.

  • #3 / Oct 22, 2012 6:14pm

    Shane Eckert

    7174 posts

    Hello jorgepinon,

    Thank you for posting in the forums!

    You are right, the upload destination must exist before hand. So create the directory on the server and then add the upload destination in the Control Panel.

    Does that make sense?

    Cheers,

  • #4 / Oct 23, 2012 1:57pm

    jorgepinon

    11 posts

    Thanks Shane, but what I meant was whether adding the directories in the config file would mean I didn’t have to add them in the control panel. Do I need the control panel at all?  can I just create the directories and edit the config file and be done?

  • #5 / Oct 24, 2012 12:22pm

    Shane Eckert

    7174 posts

    Hey jorgepinon,

    Gotcha!

    Right, whatever you put in the config file will override what is in the Control Panel. So you can bypass the Control Panel all together by just creating the directory and then adding the configs to the config file.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases