[eluser]reyntjensw[/eluser]
So as you can see, I have an add_photo view with a simple form in it.
When I fill in all the info, everything except the picture is uploaded and added in my database.
This is strange because I don't get an error everything is added except the picture info.
This is the add_photo view
Code:
<?php
echo form_open_multipart("photoalbum/do_upload");
echo "<p>";
echo form_label("Categorie");
create_dropdown("photoalbum_category_id", $cat, "id","title_nl");
echo "</p><p>";
echo form_label("Afbeelding");
echo form_upload('userfile');
echo "</p><p>";
echo form_label("Omschrijving");
echo form_input("description");
echo form_submit('upload', 'Upload');
echo form_close();
?>
This is my controller
Code:
function add_photo() {
$dbArr['cat'] = $this->photoalbum_category_model->get_all();
$this->template->write_view("content", "/photoalbum/new_image",$dbArr);
$this->template->render();
}
function do_upload() {
$config['upload_path'] = realpath(APPPATH . "../images/photoalbum/");
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '10000';
$config['max_width'] = '10240';
$config['max_height'] = '7680';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$file_data = $this->upload->data();
$data = array(
'photoalbum_category_id' => $this->input->post("photoalbum_category_id"),
'description' => $this->input->post("description"),
'file_name' => $file_data['file_name']
);
$this->photoalbum_model->insert($data);
redirect("/photoalbum/index");
}
What am I doing wrong?