Welcome Guest, Not a member yet? Register   Sign In
Image Uploader / thumbnail - controller question
#8

[eluser]deadfrog[/eluser]
OK, here's my do_upload function. I'm not making use of the M bit of MVC, but I will address that at a later date.

Code:
function do_upload() {
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '100';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        $this->load->library('upload', $config);
    
        if (!$this->upload->do_upload()) {
            $this->content['error'] = array('error' => $this->upload->display_errors());
            $this->load->view('upload/do_upload', $this->content);
        }    
        else {
            $data = $this->upload->data();
            $this->content['upload_data'] = $data;
            $this->load->database();
            $dbdata = array(
                        'name' => $data['file_name'],
                        );
            $this->db->insert('images', $dbdata);
            $image_id = $this->db->insert_id();
            redirect('upload/choose/'.$image_id, 'location');
            //$this->load->view('upload/'$image_id, $this->content);
        }
    }


Messages In This Thread
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 08:11 AM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 08:16 AM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 11:55 AM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 11:57 AM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 12:12 PM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 01:18 PM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 01:49 PM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 02:00 PM
Image Uploader / thumbnail - controller question - by El Forum - 04-13-2008, 03:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB