I have the following:
<form id="set" method="post" action="<?php echo $base_url; ?>schedule" enctype="multipart/form-data">
<?php
for($i=0;$i<10;$i++) {
?>
<input type="file" name="file[]" class="selective_file">
<input type="checkbox" name="name[]" value="<?php echo $name[$i]; ?>" style="display:none;"/>
<?php
}
?>
<input type="submit" value="Post />
</form>
The client has to submit 10 photos and once they click the button and the form is submitted, the schedule
controller gets the files as follows
public function index() {
$files = $this->input->post('files');
$name = $this->input->post('name');
print_r($files);
print_r($name);
}
I know that for uploading files in CI, the following has always worked for me
if(!$this->upload->do_upload('file')) {
$error = array('error' => $this->upload->display_errors());
print_r($error);
} else {
$pic = $this->upload->data();
}
How do I identify the files with CI so that it can be uploaded successfully while looping thru the array of files with the correct corresponding name from the checkbox field?