Data Masuk gambar tidak ter upload (Code Igniter)

ini saya mau input multiple gambar cuman kok y gambarnya gak ke upload hanya saja namanya keupload ke database, gambarnya tidak ke upload ke file yang dicari

ini code proses upload

  for ($i=1; $i <= 3; $i++) {
          $dates = date('d').time();
          $randa = rand(1,3);
          $rndmu = rand(0000, 1111);
          $rndmu = rand($rndmu+$randa, 2222);
          $rndmu = rand($rndmu+$randa, 3333);
          $rndmu = rand($rndmu+$randa, 4445);
          $random = rand($rndmu+$randa, 9999);
          if ($i === 1) {
            // Satu
            $path_satu = $_FILES['gambar1']['name'];
            $image[1] = $dates.$random.'_wrr45'.'.'.pathinfo($path_satu, PATHINFO_EXTENSION);
          } elseif ($i === 2) {
            // Dua
            $path_dua = $_FILES['gambar2']['name'];
            $image[2] = $dates.$random.'_wrr45'.'.'.pathinfo($path_dua, PATHINFO_EXTENSION);
          } elseif ($i === 3) {
            // Tiga
            $path_tiga = $_FILES['gambar3']['name'];
            $image[3] = $dates.$random.'_wrr45'.'.'.pathinfo($path_tiga, PATHINFO_EXTENSION);
          }
          // Config
          $config['upload_path'] = base_url().'cdn/images/';
          $config['upload_url'] = base_url().'cdn/images/';
          $config['allowed_types'] = 'gif|jpg|png|jpeg';
          $config['max_size'] = 2048;
          $config['file_name'] = $image[$i];
          // initialize setup config upload
          $this->upload->initialize($config);
          if (!$this->upload->do_upload('gambar1')) {
            $hahe = 'Gagal';
          } else {
            $hahe = 'Berhasil';
          }
        }

ini code form

     <div class="row" style="margin-top: -30px;margin-bottom: -20px;">
      <div class="col-md-4">
        <div class="form-group-material">
          <?php
          $att = array('class' => 'label-material',);
          echo form_label('Upload Gambar 1','gambar', $att);
          $data= array(
            'name' => 'gambar1',
            'type' => 'file',
            'class' => 'input-material',
            'accept' => 'image/*',
          );
          echo form_input($data);
          ?>
        </div>
      </div>
      <div class="col-md-4">
        <div class="form-group-material">
          <?php

          $att = array('class' => 'label-material',);
          echo form_label('Upload Gambar 2','gambar2', $att);
          $data= array(
            'name' => 'gambar2',
            'type' => 'file',
            'class' => 'input-material',
            'accept' => 'image/*',
          );
          echo form_input($data);
          ?>
        </div>
      </div>
      <div class="col-md-4">
        <div class="form-group-material">
          <?php

          $att = array('class' => 'label-material',);
          echo form_label('Upload Gambar 3','gambar3', $att);
          $data= array(
            'name' => 'gambar3',
            'type' => 'file',
            'class' => 'input-material',
            'accept' => 'image/*',
          );
          echo form_input($data);
          ?>
        </div>
      </div>
    </div>

ada sarankah ?

avatar maszgalang
@maszgalang

297 Kontribusi 80 Poin

Dipost 5 tahun yang lalu

1 Jawaban:

Jawaban Terpilih

done sudah fix

avatar maszgalang
@maszgalang

297 Kontribusi 80 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban