[eluser]markanderson993[/eluser]
Oops! Clumsy me, sorry :/ I posted the wrong portion of the controller! Here is what I really meant to post. Wow, I feel horrible
Code:
# Add Image to Image Group
if (isset($_POST['upload_album_picture']))
{
if ($this->input->post('userfile') == '') echo 'No userfile<br />';
$rules['image_group_id'] = "required";
$rules['userfile'] = "required";
$this->validation->set_rules($rules);
$names['image_group_id'] = "image group";
$names['userfile'] = "file selection";
$this->validation->set_fields($names);
if ($this->validation->run() == FALSE)
{
$data['userfile'] = $this->input->post('userfile');
} else { // Everything is filled in
echo 'Everything worked, yyay';
}
}
# Handle the page request
if ($this->db_session->userdata('id') != $id) return redirect(''); // If the ID does not match the current user's then redirect
if ($this->db_session->userdata('id') == $id) $data['editing'] = TRUE; // If ID matches the current user's
$data['profile_image'] = $this->images_model->get_profile_image($id);
$data['profile_image_tn'] = $this->images_model->get_profile_image_tn($id);
$data['image_groups'] = $this->images_model->get_image_groups($id);
$data['username'] = $this->user_info_model->get_user_name($id);
$this->template->load('images/managealbums_view',$data);
}
And just for kicks and giggles, the view:
Code:
<?php echo form_open_multipart('images/managealbums/'.$this->uri->segment(3));?>
<div style="margin-top:5px;"><b>Select an album:</b>
<select style="font-size:11px;" name="image_group_id" >
<?php if (isset($image_groups)): ?>
<?php foreach($image_groups->result() as $row): ?>
<option value="<?php echo $row->image_group_id?>"><?php echo $row->image_group_name?></option>
<?php endforeach; ?>
<?php endif; ?>
</select></div>
<div style="margin-top:5px;"><b>Select an image</b></div>
<input type="file" name="userfile" size="20" />
<div style="margin-top:5px;"><b>Title <span style="color:#666;font-size:9px;position:relative;top:-1px;">(optional)</span></b><br /><input type="text" name="image_title"></div>
<div style="margin-top:5px;">
<b>Description <span style="color:#666;font-size:9px;position:relative;top:-1px;">(optional)</span></b><textarea name="image_desc" style="padding:2px;font-size:11px;font-family:Arial, Helvetica, sans-serif;width:100%;height:100px;"></textarea>
</div>
<div style="margin-top:5px;"><input type="submit" name="upload_album_picture" value="upload" /></div>
</form>
Hope this helps? Haha