Welcome Guest, Not a member yet? Register   Sign In
Upload file and update database with post - help
#1

[eluser]Juan Velandia[/eluser]
Hello Everyone, Im trying to make this work. I have a view with form_open_multipart() pointing to this controller and i need this to update the data, and upload an image from the form in the view. the data is ok, but it doesn't upload the image.. any Ideas?


Controller:
Code:
$data_section['name'] = $this->input->post('nombre');
            $data_section['header'] = $this->input->post('header');
            $data_section['body'] = $this->input->post('body');
            $url_section = $this->input->post('url_section');

            $this->db->where('url_section', $url_section );
            $this->db->update('cms_section', $data_section);

            $config['upload_path'] = './docs/pdf/';
            $config['allowed_types'] = 'gif|jpg|png|pdf|doc|docx|ppt|pptx|xls|xlsx';
            $config['max_size']    = '2000';
            $config['max_width']  = '2048';
            $config['max_height']  = '2048';

            $this->load->library('upload', $config);

thanks in advance!
#2

[eluser]ccschmitz[/eluser]
It doesn't look like you are calling the do_upload method from the upload library. The setup looks right, but you'll need to add this line after all that:

Code:
$this->upload->do_upload();
#3

[eluser]Juan Velandia[/eluser]
Thanks ccschmitz, I'll check it! best regards!




Theme © iAndrew 2016 - Forum software by © MyBB