views:

28

answers:

1

How to specify more than one configuration in config/upload.php ?

+2  A: 

I think that it's not posible to do it, the manual says:

Setting preferences in a config file

If you prefer not to set preferences using the above method, you can instead put them into a config file. Simply create a new file called the upload.php, add the $config array in that file. Then save the file in: config/upload.php and it will be used automatically. You will NOT need to use the $this->upload->initialize function if you save your preferences in a config file.

So you're adding to the $config array() without any key to auto-initialize. Probably will be better to make a config file and load it with your config params like:

$config['upload_1']['upload_path'] = './uploads/';
$config['upload_1']['allowed_types'] = 'gif|jpg|png';
$config['upload_1']['max_size'] = '100';
$config['upload_1']['max_width']  = '1024';
$config['upload_1']['max_height']  = '768';

And loading later in your Controller with:

$this->load->config('upload_vals', TRUE);

$upload_vals = $this->config->item('upload_1');

$this->load->library('upload', $upload_vals);

Wish it helps!

Isern Palaus