Advertisement
Guest User

control

a guest
Oct 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public function upload_foto()
  2. {
  3. $ket = $this->input->post('ket');
  4. $idwft = $this->input->post('idwft');
  5. $gambar = $_FILES['image']['name'];
  6. if ($gambar) {
  7. $config['allowed_types'] = 'jpg|gif|png';
  8. $config['max_size'] = '1024';
  9. $config['upload_path'] = './assets/img/';
  10. $config['file_name'] = round(microtime(true)*1000);
  11.  
  12. $this->load->library('upload', $config);
  13. if ($this->upload->do_upload('image')) {
  14. $nm_gbr = $this->upload->data('file_name');
  15. $uploaded = $this->pengeluaran_m->uploadFoto($ket, $nm_gbr, $idwft);
  16. if ($uploaded > 0){
  17. $data_session = array(
  18. 'sts' => 'sukses',
  19. 'pesan' => 'Foto berhasil di input'
  20. );
  21. } else {
  22. $data_session = array(
  23. 'sts' => 'error',
  24. 'pesan' => 'gagal menyimpan data '.$uploaded
  25. );
  26. }
  27. } else {
  28. $data_session = array(
  29. 'sts' => 'error',
  30. 'pesan' => $this->upload->display_errors()
  31. );
  32. }
  33.  
  34. echo $this->session->set_flashdata($data_session);
  35. redirect("pengeluaran/report/".$idwft);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement