How to upload image in perfex crm?

Viewed 24

i have added file input field in new item form for adding image & created a folder naming items_ref_picture in uploads folder to save images.enter image description here

In view

<div class="form-group">
 <label for="refpicture" class="control-label">Upload Ref. Picture</label>
 <input type="file" id="refpicture" name="refpicture" class="form-control" value="">    
</div>

In controller

$config['upload_path']          = './uploads/items_ref_picture';
$config['allowed_types']        = 'gif|jpg|png';
$config['max_size']             = 100;
$config['max_width']            = 1024;
$config['max_height']           = 768;
                
$this->load->library('upload', $config);
                
                
if ($this->upload->do_upload('refpicture'))
{
     $data = array('refpicture' => $this->upload->data());
}
else{
      $data = array('error' => $this->upload->display_errors());
}

I don't know what's the error.

0 Answers
Related