[HOME]

Path : /home/hermanostamargo/www/administracion/content/trabajos/
Upload :
Current File : /home/hermanostamargo/www/administracion/content/trabajos/trabajos-delete.php

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


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


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