FileMaster
Search
Toggle Dark Mode
Home
/
.
/
back
Edit File: hapus_gambar.php
<?php require 'config.php'; if (isset($_POST['gambar'])) { $gambar = $_POST['gambar']; $path = __DIR__ . "/uploads/" . $gambar; if (file_exists($path)) { if (unlink($path)) { echo "File berhasil dihapus"; } else { echo "Gagal menghapus file meskipun ada"; } } else { echo "File tidak ditemukan: " . $path; } // (Opsional) hapus dari database $stmt = $pdo->prepare("DELETE FROM gambar WHERE nama_gambar = ?"); $stmt->execute([$gambar]); } ?>
Save
Back