tidak bisa upload gambar pada pc lain

gann saya ingin bertanya kenapa ya ketika saya mengupload pada laptop saya berhasil namun apabila mengupload melalui pc lain dan melalui mobile file tidak berhasil terupload atau gambar tidak masuk ke folder hanya namanya saja masuk ke database

ini codingan saya terimakasih gann

 public function uploadgambar($nmacara=null){
	if($this->session->has_userdata('username')){
		$this->form_validation->set_rules('nama_acara','Nama acara','trim|required|min_length[3]');
			$this->form_validation->set_rules('date','required');
			if (empty($_FILES['gambar']['name']))
		{
		$this->form_validation->set_rules('gambar_acara', 'GAMBAR', 'required');
		}
		if($this->form_validation->run()===FALSE){
			$data['acara_nama']=$this->admin_model->get_gallery($nmacara);
					$this->load->view('admin/pages/static/header');
			$this->load->view('admin/pages/forms/uploadgambar',$data);
				$this->load->view('admin/pages/static/footer');
		}else{

			if (!empty($_FILES['gambar']['name']))
		{
      $this->load->library('upload');

   $files = $_FILES;
   $cpt = count($_FILES['gambar']['name']);
   for($i=0; $i<$cpt; $i++){
     $_FILES['gambar']['name']= $files['gambar']['name'][$i];
             $_FILES['gambar']['type']= $files['gambar']['type'][$i];
             $_FILES['gambar']['tmp_name']= $files['gambar']['tmp_name'][$i];
             $_FILES['gambar']['error']= $files['gambar']['error'][$i];
             $_FILES['gambar']['size']= $files['gambar']['size'][$i];
						 $namafolder =($this->input->post('nama_acara'));
             $uploadPath = 'uploads/acara/'.$namafolder;
              $config['upload_path'] = $uploadPath;
              $config['allowed_types'] = 'gif|jpg|png';
              	$config['max_size']= 0;
							$name =$this->input->post('nama_acara');
							$new_name = $name."_".date('Y-m-d')."_TIME_".date('h-i-s-A')."_".$_FILES['gambar']['name'];
								 $config['file_name'] = $new_name;
              $this->load->library('upload', $config);
             $this->upload->initialize($config);
             $this->upload->do_upload('gambar');
             $dataInfo = $this->upload->data();

              $uploadData[$i]['gambar'] = $dataInfo['file_name'];
              $uploadData[$i]['date'] = $this->input->post('date');
              $uploadData[$i]['nama_acara'] = $this->input->post('nama_acara');
   }

    $result_set = $this->admin_model->set_gambar($uploadData);



	$backreload = $_SERVER["HTTP_REFERER"];
	echo "
	<script>
			alert('Gambar berhasil diupload !');
			document.location.href='$backreload';
			</script>
				";
		}

	}

}else {
  redirect('admin/login');
}
}
avatar farisdewantoro
@farisdewantoro

119 Kontribusi 16 Poin

Dipost 6 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban