I'm trying to upload an image to a file path and insert that path to the database. However, the upload always shows the error You did not select a file to upload ..even though I did.
Here's my VIEW
<form action="<?= site_url('profile/profile_submit')?>" method="post" enctype="multipart/form-data">
<input type="file" class="image-upload" accept="image/*" name="profilePic" id="profilePic"/>
</form>
CONTROLLER
$config['upload_path'] = 'assets/img/profile_img/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['overwrite'] = TRUE;
$config['max_size'] = "2048000";
$config['max_height'] = "768";
$config['max_width'] = "1024";
$this->load->library('upload', $config);
if ($this->upload->do_upload('profilePic')){
$data = $this->upload->data();
$picture = array(
'photoPath' => $this->upload->data('full_path').$data['file_name']
);
}
else{
echo $this->upload->display_errors();
}
$this->profile_model->submit_profile($picture);
MODEL
function submit_profile($picture){
$this->db->insert('tbl_st_picture', $picture);
}