Welcome Guest, Not a member yet? Register   Sign In
Simple upload problem
#5

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

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:
&lt;?php echo form_open_multipart('images/managealbums/'.$this->uri->segment(3));?&gt;

<div style="margin-top:5px;"><b>Select an album:</b>
<select style="font-size:11px;" name="image_group_id" >
&lt;?php if (isset($image_groups)): ?&gt;
    &lt;?php foreach($image_groups->result() as $row): ?&gt;
    <option value="&lt;?php echo $row->image_group_id?&gt;">&lt;?php echo $row->image_group_name?&gt;</option>
    &lt;?php endforeach; ?&gt;
&lt;?php endif; ?&gt;
</select></div>

<div style="margin-top:5px;"><b>Select an image</b></div>

&lt;input type="file" name="userfile" size="20" /&gt;

<div style="margin-top:5px;"><b>Title <span style="color:#666;font-size:9px;position:relative;top:-1px;">(optional)</span></b><br />&lt;input type="text" name="image_title"&gt;&lt;/div>

<div style="margin-top:5px;">
<b>Description <span style="color:#666;font-size:9px;position:relative;top:-1px;">(optional)</span></b>&lt;textarea name="image_desc" style="padding:2px;font-size:11px;font-family:Arial, Helvetica, sans-serif;width:100%;height:100px;"&gt;&lt;/textarea>
</div>

<div style="margin-top:5px;">&lt;input type="submit" name="upload_album_picture" value="upload" /&gt;&lt;/div>

&lt;/form&gt;

Hope this helps? Haha


Messages In This Thread
Simple upload problem - by El Forum - 08-10-2008, 08:19 AM
Simple upload problem - by El Forum - 08-10-2008, 09:22 AM
Simple upload problem - by El Forum - 08-10-2008, 12:29 PM
Simple upload problem - by El Forum - 08-10-2008, 02:24 PM
Simple upload problem - by El Forum - 08-10-2008, 11:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB