Hey all,

I am building a simple cms. I have a posts table and I have an images table. A post has many images and images has a foreign key to the posts table. So when a user edits, updates, creates, and deletes a post, they affect the images related to the post. Sometimes a post can have more than one image, like three images. Hence I rendered this in the view (note that I am using a datamapper that converts tables to objects and fields to key/value pairs):

Code:
	foreach($records as $post){
		echo form_open_multipart("homes/update/$post->id"); //File uploads require a multipart form. Default form handling uses the application/x-www-form-urlencoded content type. Multipart forms use the multipart/form-data encoding. //this is critical to pass the id as part of the action attribute of the form, so we can use our params hash to target the id to update the specific record
 
 		echo label('Update Title');
		echo form_input('title',$post->title);
		echo label('Update Body');
		echo form_textarea('body',$post->body);
		
 		$images = $post->images->include_join_fields()->get();
		if(!is_null($images->image_file_name)){  
 			echo label('Update Images');		
			foreach($images as $image){
				echo form_upload('image_file_name',$image->image_file_name);  
			}
		}

	}
	echo form_submit('submit','Update');
The above line of code will render a few input file types. The problem occurs during posting to my update method. It is looking for one parameter from the input file field and so if I upload three different images, it will only look for one and write only one to database:

Code:
$field_name = 'image_file_name';
 			if ( ! $this->upload->do_upload($field_name)){
 				$error = array('error' => $this->upload->display_errors());
				echo $error['error'];
			//	redirect('homes/edit');
  			}
			else {
 				$data = array('upload_data' => $this->upload->data());
				$image_file_name = $data['upload_data']['file_name'];
Is it possible to do wht I am trying to do? Should I only have on input file type per form submission or is that I need to fix the code to accomodate for multiple submissions by creating an array of sorts?

Thanks for response.