Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function tambahanggota() {
- $this->load->library('upload');
- $nmfile = "file_".time();
- $config['upload_path'] = './assets/uploads/';
- $config['allowed_types'] = 'gif|jpg|png|jpeg|bmp';
- $config['max_size'] = '3072';
- $config['max_width'] = '5000';
- $config['max_height'] = '5000';
- $config['file_name'] = $nmfile;
- $this->upload->initialize($config);
- if($_FILES['filefoto']['tmp_name'])
- {
- if ($this->upload->do_upload('filefoto'))
- {
- $gbr = $this->upload->data();
- $data = array(
- 'nm_gbr' =>$gbr['file_name']
- );
- $res = $this->M_tambahdata->tambahdata("anggota",$data);
- $config2['image_library'] = 'gd2';
- $config2['source_image'] = $this->upload->upload_path.$this->upload->file_name;
- $config2['new_image'] = './assets/hasil_resize/';
- $config2['maintain_ratio'] = TRUE;
- $config2['width'] = 100;
- $config2['height'] = 100;
- $this->load->library('image_lib',$config2);
- if ($res>=1) {
- echo "<script>alert('Data berhasil disimpan')</script>";
- echo "<script>window.location='".base_url()."dataanggota'</script>";
- }
- else{
- $this->session->set_flashdata('pesan', 'Maaf, ulangi data gagal di inputkan.');
- redirect('dashboard/index');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement