CodeIgniter Forums

Full Version: Upload Not Working..?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Corey Freeman[/eluser]
I dunno what's wrong with my controller, but it's just not uploading.

Code:
<?php
class Goals extends Controller {
    function Goals() {
    parent::Controller();
    }
    function index() {
        if(!$this->uri->segment(2)) {
        redirect('home');
        }
        $id = $this->uri->segment(2);
        $this->db->where('id', $id);
        $query = $this->db->get('goals');
        foreach($query->result() as $row):
        $title = $row->goal;
        $user_id = $row->user_id;
        $data['user_id'] = $row->user_id;
        endforeach;
        $this->db->where('id', $user_id);
        $data['user'] = $this->db->get('users');
        $data['title'] = $title;
        $this->db->where('id', $id);
        $data['query'] = $this->db->get('goals');
        $this->load->view('goals', $data);
    }
    function edit() {
        $config['upload_path'] = 'http://www.cloudreve.com/uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '100';
        $config['max_width'] = '1024';
        $config['max_height'] = '768';
        $this->load->library('upload', $config);
        $this->upload->do_upload();
        $this->load->model('goal_model');
        $this->goal_model->update_goal();
        redirect('goals/'.$this->uri->segment(3));
    }    
}

El Forum

[eluser]mi6crazyheart[/eluser]
I think u'r upload path probably should like this...
Code:
$config['upload_path'] = '/uploads/'; // if it is in root folder