Postingan lainnya
Saya mengalami error warning: move_uploaded_file()
Saya mengalami error
Warning: move_uploaded_file() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\peminjaman\prosestambahbrg.php on line 17
<?php
include'config/koneksi.php';
$namafolder="upload/"; //tempat menyimpan file
$id_brg = $_POST ['id_brg'];
$nama_brg = $_POST['nama_brg'];
$jenis_brg = $_POST ['jenis_brg'];
$stok_brg = $_POST ['stok_brg'];
$foto = $_POST['foto'];
if (isset($_POST['tambah'])){
$dir = "/images/";
$fileName = $dir.basename($_FILES['foto']['name']);
// var_dump($fileName);
// die();
// Simpan di Folder Gambar
move_uploaded_file($fileName);
//$query = $mysqli->query("INSERT INTO barang values ('$id_brg', '$nama_brg','$jenis_brg','$stok_brg','$fileName')");
}
if ($query) {
header("location:barang.php");
} else {
echo "gagal menambah data";
}
?>
0
2 Jawaban:
Sertakan dua parameter move_uploaded_file($nama_filenya, $kemana_akan_di_upload)
2
ada 2 parameter, file tmp_name dan lokasi tujuan <pre> move_uploaded_file($_FILES['foto']['tmp_name'], $fileName); </pre>
0