Cara replace upload file lama dengan file baru gmn ya?

if ($data['upload_spk'] = "") {
            $config['upload_path']  = './assets/upload';
            $config['allowed_types'] = 'jpg|png|pdf';

            $this->load->library('upload',  $config);
            if (!$this->upload->do_upload('upload_spk')) {
                echo "upload gagal";
                die();
            } else {
                $data['upload_spk'] = $this->upload->data('file_name');
            }
        } else {
            if ($_FILES['upload_spk']['name'] != "") {
                $config['upload_path']  = './assets/upload';
                $config['allowed_types'] = 'jpg|png|pdf';

                $this->load->library('upload',  $config);
                if (!$this->upload->do_upload('upload_spk')) {
                    echo "upload gagal";
                    die();
                } else {
                    //upload_spk diubah
                    $data['upload_spk'] = $this->upload->data('file_name');
                    $id_ajukan = $this->input->post('id_ajukan');
                    $query = $this->db->get('pengajuan_lelang', array('id_ajukan' => $id_ajukan));
                    $ambil = $query->row()->upload_spk;
                    unlink('./assets/upload/' . $ambil);
                }
            } else {
                $data['upload_spk'] = $this->input->post('lama');

            }
        }
avatar aulianailal98
@aulianailal98

2 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Tanggapan

halo jangan cuma upload kode ya, tpai dijelaskan kode kamu. apa yang bermasalah, bagian mana, apa yang diinginkan dan seterusnya

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban