Postingan lainnya
Undefined property: stdclass::$xfile
Tolong pencerahanya mas gan saya masih nubie jika error begini gimana mas gan...?
Undefined property: stdClass::$xfile ....on line 43
unlink(assets/uploads/dokumen/internal/): No such file or directory in ....on line 35
<?php
require_once('../config/koneksi.php');
require_once('../models/database.php');
include "../models/m_internal.php";
$connection = new Database($host, $user, $pass, $database);
$int = new Internal($connection);
$id = $_POST['id'];
$nomor = $connection->conn->real_escape_string($_POST['nomor']);
$kategori = $connection->conn->real_escape_string($_POST['kategori']);
$departemen = $connection->conn->real_escape_string($_POST['departemen']);
$revisi = $connection->conn->real_escape_string($_POST['revisi']);
$tanggal = $connection->conn->real_escape_string($_POST['tanggal']);
$status = $connection->conn->real_escape_string($_POST['status']);
$nama = $connection->conn->real_escape_string($_POST['nama']);
$objek = $_FILES['xfile']['name'];
$extensi = explode(".", $_FILES['xfile']['name']);
$xfile = "internal-".round(microtime(true)).".".end($extensi);
$sumber = $_FILES['xfile']['tmp_name'];
if($objek == '') {
$int->edit("UPDATE tb_internal SET
nomor_dokumen = '$nomor',
kategori_dokumen = '$kategori',
departemen_dokumen = '$departemen',
revisi_dokumen = '$revisi',
tanggal_revisi = '$tanggal',
status_dokumen = '$status',
nama_dokumen = '$nama' WHERE id = '$id'");
echo "<script>window.location='?page=dokumen-internal';</script>";
} else {
$file_lama = $int->tampil($id)->fetch_object()->xfile;
unlink("../assets/uploads/dokumen/internal/".$file_lama);
$upload = move_uploaded_file($sumber, "../assets/uploads/dokumen/internal/".$xfile);
if($upload) {
$int->edit("UPDATE tb_internal SET
nomor_dokumen = '$nomor',
kategori_dokumen = '$kategori',
departemen_dokumen = '$departemen',
revisi_dokumen = '$revisi',
tanggal_revisi = '$tanggal',
status_dokumen = '$status',
nama_dokumen = '$nama',
file_dokumen = '$xfile' WHERE id = '$id'");
echo "<script>window.location='?page=dokumen-internal';</script>";
} else {
echo "<script>alert('Upload File Gagal!')</script>";
}
}
?>
Terima Kasih...
0
1 Jawaban:
$int->tampil($id)->fetch_object()->xfile
coba di print_r dulu, ada tidak datanya
0
Tanggapan
Sudah mas gan..masih sama undefined property stdClass