can a custom helper extend library in codeigniter
I see you want to call the library inside your helper and not to extend it. You should call get_instance()
first because $this
only works oncontrollers and models. If you want to use a helper or library you need to call the get Codeigniter's instance first
Your code should look like this:
class Your_helper_name{ private $CI; function __construct(){ $this->CI =& get_instance(); } function FileUploadd($r) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->CI->load->library('upload', $config); if ( ! $this->CI->upload->do_upload($r)) { echo $this->CI->upload->display_errors(); } else { $Dder=$this->CI->upload->data(); return $Dder['file_name']; } }}
Let me know if you need clarification. If this answers your question, please mark this as answer. Thanks!