Welcome Guest, Not a member yet? Register   Sign In
How do you loop an upload data to a table without entering empty fields?
#1

[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?


Messages In This Thread
How do you loop an upload data to a table without entering empty fields? - by El Forum - 05-11-2009, 10:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB