[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