<?php



$a = date('Y');
$m = date('m');
$carpeta = "$m-$a";



include 'concha.php';
// A list of permitted file extensions
$allowed = array('jpg', 'jpeg', 'gif', 'png');

if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){

	$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);

	if(!in_array(strtolower($extension), $allowed)){
		echo '{"status":"error"}';
		exit;
	}

		$tempm = $_FILES['upl']['tmp_name'];
		  $mime = mime_content_type($tempm);


		 if ($mime == 'image/png' or $mime == 'image/jpeg' or $mime == 'image/gif') {} else {echo "no valido"; exit;}


	if(move_uploaded_file($_FILES['upl']['tmp_name'], "$carpeta/".$_FILES['upl']['name'])){
		echo '{"status":"success"}';


		$mp3 = $_FILES['upl']['name'];

		$mp3 = "$dom/$carpeta/$mp3";




 $IDa = $_POST['IDa'];


include 'concha.php';

$sSQL = "INSERT INTO  `$basedatos`.`fotos` (`ID`,`titulo`,`foto`,`album`,`carpetafoto`)VALUES (NULL ,'','$mp3','$IDa','$carpeta');";
$conn->query($sSQL);




		exit;
	}
}

echo '{"status":"error"}';
exit;
