<?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;

	}



	if(move_uploaded_file($_FILES['upl']['tmp_name'], "$carpeta/".$_FILES['upl']['name'])){

		echo '{"status":"success"}';





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



		$mp3 = "$carpeta/$mp3";









 $ID_nota = $_POST['ID_nota'];



include 'concha.php';




$sSQL = "INSERT INTO `galeria_de_medios` (`ID`,`URL`,`descripcion`,`tipo`,`ID_nota`) VALUES (NULL,'$mp3','','img','0');";
$conn->query($sSQL);


		exit;

	}

}



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

exit;
