Welcome Guest, Not a member yet? Register   Sign In
upload form with extra information in it
#3

[eluser]Dizza[/eluser]
[quote author="jpijper" date="1294621980"]You're not passing $data to save_image?[/quote]

Thanks for your feedback!
I now edited this line
Code:
$this->upload_model->save_image($file_name);

to

Code:
$this->upload_model->save_image($file_name, $data);


but it still inserts nothing except the imagename to the database..

thx

EDIT:Already solved it lol, how could i be so stupid! Thanks for the reply jpijper


For the people who need this solution to, its simple:

Controller:
Code:
$data = array('upload_data' => $this->upload->data());
            echo "Het nieuwe gerecht is geupload";
            $img_data = $this->upload->data();
            $file_name = $img_data['file_name'];
            $this->load->model('upload_model');
            $this->upload_model->save_image($file_name);

Model
Code:
function save_image($image_name = '')
    {
        $this->db->insert('voorgerecht',array(    
                                              'naam'     => $this->input->post('naam'),    
                                              'beschrijving'     => $this->input->post('beschrijving'),    
                                              'ingredienten'     => $this->input->post('ingredienten'),            
                                              'afbeelding'=>$image_name                                              
                                              ));


Messages In This Thread
upload form with extra information in it - by El Forum - 01-09-2011, 12:48 PM
upload form with extra information in it - by El Forum - 01-09-2011, 01:13 PM
upload form with extra information in it - by El Forum - 01-09-2011, 01:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB