[eluser]dallen33[/eluser]
Here is a bit of my code:
Code:
for ($i = 1; $i <= 10; $i++)
{
$field_name = 'file'.$i;
$this->upload->do_upload($field_name);
$data = array('upload_data' => $this->upload->data());
$this->booking->attachments($attach_id, $data['upload_data']['file_name'], $data['upload_data']['file_type'], $data['upload_data']['file_size']);
}
Basically I'm uploading some files and adding the file info to a database. However, it duplicates entries if you upload less than 10 files (I have 10 upload fields). Any idea how I would only update the database if a file from the file input exists and was uploaded?