Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function upload_foto()
- {
- $ket = $this->input->post('ket');
- $idwft = $this->input->post('idwft');
- $gambar = $_FILES['image']['name'];
- if ($gambar) {
- $config['allowed_types'] = 'jpg|gif|png';
- $config['max_size'] = '1024';
- $config['upload_path'] = './assets/img/';
- $config['file_name'] = round(microtime(true)*1000);
- $this->load->library('upload', $config);
- if ($this->upload->do_upload('image')) {
- $nm_gbr = $this->upload->data('file_name');
- $uploaded = $this->pengeluaran_m->uploadFoto($ket, $nm_gbr, $idwft);
- if ($uploaded = null){
- $data_session = array(
- 'sts' => 'sukses',
- 'pesan' => 'Foto berhasil di input'
- );
- } else {
- $data_session = array(
- 'sts' => 'error',
- 'pesan' => 'gagal menyimpan data '.$uploaded
- );
- }
- } else {
- $data_session = array(
- 'sts' => 'error',
- 'pesan' => $this->upload->display_errors()
- );
- }
- echo $this->session->set_flashdata($data_session);
- redirect("pengeluaran/report/".$idwft);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement