[eluser]xwero[/eluser]
You can only validate/upload one file at the time using the upload class so you would have to do something like this
Code:
$fields = array('userfile','videofile');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config2['upload_path'] = './uploads/';
$config2['allowed_types'] = 'avi|wmv|mov';
foreach($fields as $field)
{
if(isset($_FILES[$field]))
{
switch($field)
{
case 'userfile':
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
// error
}
else
{
// success
}
break;
case 'videofile':
$this->load->library('upload', $config2);
if ( ! $this->upload->do_upload())
{
// error
}
else
{
// success
}
break;
}
}
}
It's a bit messy but i think you get the picture.