[HOME]

Path : /home/hermanostamargo/ftp/administracion/news/news/
Upload :
Current File : /home/hermanostamargo/ftp/administracion/news/news/delete.php

<?php
include("../../../defines.php");
$output_dir = "img/";
include("../../bd-con.php");

$coleccion = $_POST['coleccion'];

mysqli_query($conn,"SET NAMES 'utf8'");
if(isset($_POST["op"]) && $_POST["op"] == "delete" && isset($_POST['name']))
{
	$fileName =$_POST['name'];
	$filePath = $output_dir . $fileName;
	if (file_exists($filePath)) 
	{
        unlink($filePath);		
		$sql = "DELETE FROM " . $coleccion . " WHERE imagen ='".$fileName."'";
		$res=mysqli_query($conn,$sql) or die ("error en el servidor");


    }
    
	echo "Archivo eliminado ".$fileName."<br>";
}
mysqli_close($conn);
?>