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

[eluser]Shella[/eluser]
Hi,
should be a pretty easy thing to do but is couple of hours I'm trying invane.
In PHP it's pretty easy when you upload a file you have to catch the $_FILES data but here...?

The point is that I have no error back in the select I just have an empty value.

I guess is the model to understand.

VIEW
Code:
[...]
echo form_open_multipart('backend/write_article');
[...]
echo form_upload('article_file');
[...]
echo form_submit('submit', 'Publish', $attributes['class']);
echo form_submit('submit', 'Reset');
echo form_close();
[...]

CONTROLLER
Code:
[...]
$this->load->model('articles_model');
  
   if($query = $this->articles_model->create_article())
   {
    //some stuff...
   }
[...]

MODEL
Code:
function create_article()
{
  $created_on = date ("Y-m-d H:i:s", time());
  
  $new_article_insert_data = array(
  'title' => $this->input->post('title'),
  'content' => $this->input->post('content'),
  'image' => $this->input->post('article_file'), //THIS IS THE POINT
  'id_category' => $this->input->post('category'),
  'created_on' =>  $created_on,
  );
  
  $insert = $this->db->insert('articles', $new_article_insert_data);
  return $insert;
}

Thanks for help


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