Hello I have a write a code that upload image path into the database but the thing is it uploads the real path (C:/wamp/www/amref/images/student_profile/childbrah2.jpg
) hence when I fetch the path form the database in order to display the image it gives me the error that the link is broken. I want to store only (images/student_profile/childbrah2.jpg).
The controller code:
$config['upload_path'] = '../images/student_profile/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = "2048000"; // Can be set to particular file size , here it is 2 MB(2048 Kb)
$config['max_height'] = "768";
$config['max_width'] ="1024";
$this->load->library('upload', $config);
if(!$this->upload->do_upload()){
echo '<h4 style="color: red;">
Failure! </h4>
<p style="color: red;">'.$this->upload->display_errors().'</p>';
} else {
$data_upload_files = $this->upload->data();
$image = base_url($data_upload_files['full_path']);