Welcome Guest, Not a member yet? Register   Sign In
Store Image path into DB
#4

[eluser]NotDior[/eluser]
Shella,

Sorry for the delay on getting back to you. It appears to me that part of the problem might be that you are trying to grab your upload data directly in the model rather than throwing that data into an array() in your controller and then passing that array to your model. See if something like this gets you down the road.

CONTROLLER
Code:
[...]
$this->load->model('articles_model');
  $aData['title'] = $this->input->post('title');
  $aData['content'] = $this->input->post('content');
  $aData['id_category'] = $this->input->post('category');
  $aData['created_on'] =  date ("Y-m-d H:i:s", time());

   $aData['fileinfo'] = $this->upload->data();
   if($query = $this->articles_model->create_article($aData))
   {
    //some stuff...
   }
[...]

MODEL
Code:
function create_article($aData)
{

  // you'll have to play around with the $aData to get it formatted exactly correct...
  return($this->db->insert('articles', $aData));
  
}

Lastly in your last post/example it looks like $this->upload->data('file_name') is an array for some reason.


Messages In This Thread
Store Image path into DB - by El Forum - 06-14-2012, 03:15 AM
Store Image path into DB - by El Forum - 06-14-2012, 07:45 AM
Store Image path into DB - by El Forum - 06-14-2012, 08:21 AM
Store Image path into DB - by El Forum - 06-18-2012, 01:04 PM
Store Image path into DB - by El Forum - 06-23-2012, 02:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB