It's me again. I have a problem in inserting the name of the uploaded file on the database. I've successfully uploaded the file and the file has been moved to the dir that I want, can anyone help me to figure it out what's wrong in my code? Also, I've tried putting some echo on it and I got "not success", and make the database value nullable. here's my code.
<?php
session_start();
include "../../3rdparty/engine.php";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if ($_SESSION['daya_user'] != '') {
if ($_FILES['dokumen']['name'] != "") {
//print_r($_POST);
$path = $_FILES['dokumen']['name'];
$ext = pathinfo($path, PATHINFO_EXTENSION);
$nama_file = 'SO'.'-'.date("Ymd").'.'.$ext;
@copy($_FILES['dokumen']['tmp_name'], '../../dokumen_atk/'.$nama_file);
mysqli_query($con,"insert into tbl_atk (name_file) values ('$nama_file')");
header("location:../../index.php?mod=atk&submod=so_upload");
}
}
//header("location:../../index.php?mod=atk&submod=so_upload");
?>