<?php 
		header("Access-Control-Allow-Origin: *");
		header("Access-Control-Allow-Headers: access");
		header("Access-Control-Allow-Methods: GET");
		header("Access-Control-Allow-Credentials: true");
		header("Content-Type: application/json; charset=UTF-8");
		
		

include_once '../Database.php';
include_once 'concepto.php';

$database = new DataBase();
$db = $database->getConnection();

$concepto = new Concepto($db);
try{
	$conceptoid = isset($_GET['id'])?$_GET['id']:die();
	$imagen = isset($_GET['nombre'])?$_GET['nombre']:die();
	$imagenC = "https://promozonea.com.mx/Mercado/Conceptos/uploads/".$imagen;
	$query = "UPDATE ".$concepto->table_name." SET imagen=:imagen WHERE id=:id";
	$stm = $concepto->conn->prepare($query);
	$stm->bindParam(":id",$conceptoid);
	$stm->bindParam(":imagen",$imagenC);
	$stmt = $client->Update($stm);
	if($stmt !==false){
		echo json_encode(array("Mensaje"=>"Imagen Actualizada"));
	}else{
		echo json_encode(array("Error"=>"No se ha podido actualizar la imagen"));
	}
}catch(Exception $ex){
	echo json_encode(array("Error"=>"No se ha podido procesar la solicitud"));
}

?>