Skip to content

Instantly share code, notes, and snippets.

@imranhoshain
Created October 1, 2018 06:25
Show Gist options
  • Select an option

  • Save imranhoshain/ee2936f0586adfd27cf49012afd68814 to your computer and use it in GitHub Desktop.

Select an option

Save imranhoshain/ee2936f0586adfd27cf49012afd68814 to your computer and use it in GitHub Desktop.
public function save_admin(){
$data = array();
$data['admin_image'] = $this->input->post('admin_image',true);
$sdata = array();
$error = "";
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100000;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('admin_image'))
{
$error = $this->upload->display_errors();
}
else
{
$sdata = $this->upload->data();
$data['admin_image'] = $sdata['file_name'];
}
$this->db->INSERT('admin',$data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment