Postingan lainnya
Error Notice: Undefined index:
Sore,
Mohon bantuannya, saya tengah mencoba mengupload foto kedalam database tp kok muncul error yaa..pesannya :
Notice: Undefined index: file in C:\xampp\htdocs\Berita\input_user.php on line 20
Notice: Undefined index: file in C:\xampp\htdocs\Berita\input_user.php on line 23
Notice: Undefined index: file in C:\xampp\htdocs\Berita\input_user.php on line 24
Ektensi tidak boleh !!
saya coba cari2 tp ngga nemu kenapanya..bisa tolong dibantu?
thx,
Joe
<?php
include("config/connection.php");
if (isset($_POST['submit']))
{
$id=$_POST['id'];
$nama=$_POST['nama'];
$dept=$_POST['dept'];
$pass=md5($_POST['pass']);
$password=$_POST['pass'];
$tgl2=date("Y-M-D",strtotime('now'));
$tgld =date_default_timezone_get();
$level=$_POST['level'];
$email=$_POST['email'];
$sts=$_POST['sts'];
$ektensi_boleh=array('jpg','jpeg','png','bmp','tif' );
$nama=$_FILES['pic']['name'];
$x=explode('.', $nama);
$ektensi=strtolower(end($x));
$ukuran=$_FILES['pic']['size'];
$file_tmp=$_FILES['pic']['tmp_name'];
$cekdata="select * from user where id='$id'";
$ada=mysqli_query($db,$cekdata) or die(mysqli_error($db));
if(in_array($ektensi, $ektensi_boleh)===true){
if (mysqli_num_rows($ada)>0)
{
echo "<script>window.alert('Record Already Exists !!');window.history.back();</script>";
}
else
{
$sql= "insert into user(id,nama,dept,pass,level,email,sts,pic)
value ('$id','$nama','$dept','$pass','$level','$email','$sts','$nama')";
$query=mysqli_query($db,$sql) or die(mysqli_error($db));
//simpan ke folder
move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);
header('Location:list_user.php?status=Success !!');
}
}else //{ echo "<script>window.alert('Picture File cannot be uploaded !!');window.history.back();</script>";}
{echo 'Ektensi tidak boleh !!';}
}
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban