Question: When running MSM add-on, how can I manage the file upload folders etc, via a config.php file?

Ideally I would want to use a hook to do it, but it doesn't seem to work.

Normally I would do this:

> 
> 
> ```
>   $config['upload_preferences'] = array(
>         1 => array(
>             'name'        => 'Images',
>             'server_path' => $uploads_path . "/images/",
>             'url'         => $uploads_url . "/images/"
>         ),
>         2 => array(
>             'name'        => 'Files',
>             'server_path' => $uploads_path . "/files/",
>             'url'         => $uploads_url . "/files/"
>         ),
>         3 => array(
>             'name'        => 'Icons',
>             'server_path' => $uploads_path . "/icons/",
>             'url'         => $uploads_url . "/icons/"
>         )
>     );
> 
> ```
> 
>

Answer: 
Actually, every upload location you create is going to have a different ID, be it one site or in multiple sites using MSM. You can thus safely keep everything in config.php becuse every upload location you define (even if you share physical folders) is going to have a different ID anyway.

Basically:

* Step 1: create all your upload location in the CP for all sites
* Step 2: take the upload location id and configure all upload location
in your central config.php file for all sites. Since they all have
specific ids, no conflict problem whatsoever
If you want to override MSM settings then you should move this code into the index.php file of the sites respectively.

```
$assign_to_config['upload_preferences'] = array(
        1 => array(
            'name'        => 'Images',
            'server_path' => $uploads_path . "/images/",
            'url'         => $uploads_url . "/images/"
        ),
        2 => array(
            'name'        => 'Files',
            'server_path' => $uploads_path . "/files/",
            'url'         => $uploads_url . "/files/"
        ),
        3 => array(
            'name'        => 'Icons',
            'server_path' => $uploads_path . "/icons/",
            'url'         => $uploads_url . "/icons/"
        )
    );

```

Be mindful though, I've experienced a known bug where some values are set in the config of MSM sites but aren't reflected in the CP.