This is the code so far. I have 2 images that are getting uploaded and added to the desired map. My question is, how do i get both names from the images so I can add just the names to the database together with my other form information.
public function CreateTypesForGamma() {
$type = new stdClass();
$type->TypeID = $this->input->post('typeID') == 0 ? null : $this->input->post('typeID');
$type->Titel = $this->input->post('titel');
$type->TechnischeFiche = $this->input->post('technischeFiche');
$type->GammaID = $this->input->post('gammaID');
$type->ExtLink = $this->input->post('extLink');
$type->InfoNL = $this->input->post('infoNL');
$type->InfoFR = $this->input->post('infoFR');
$type->InfoEN = $this->input->post('infoEN');
$files = $_FILES;
$cpt = count($_FILES['userfile']['name']);
for($i=0; $i<$cpt; $i++)
{
$_FILES['userfile']['name']= $files['userfile']['name'][$i];
$_FILES['userfile']['type']= $files['userfile']['type'][$i];
$_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
$_FILES['userfile']['error']= $files['userfile']['error'][$i];
$_FILES['userfile']['size']= $files['userfile']['size'][$i];
$this->upload->initialize($this->set_upload_options());
$this->upload->do_upload();
$fileName = $_FILES['userfile']['name'];
if ($i == 0)
$images[] = $fileName;
}
$fileName = implode(',',$images);
$this->gamma_model->upload_image($fileName);
system.out.println($images);
if ($type->TypeID == 0) {
$type->TypeID = $this->type_model->insert($type);
} else {
$this->type_model->update($type);
}
redirect('gamma/viewAdminGamma');
}
private function set_upload_options()
{
// upload an image options
$config = array();
$config['upload_path'] = APPPATH . 'images/types'; //give the path to upload the image in folder
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '5120';
$config['overwrite'] = FALSE;
return $config;
}