<?php





// A list of permitted file extensions

$allowed = array('png', 'jpg', 'gif');



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;

	}



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



$ext = substr($foto,-4);

$foto = md5($foto);



$foto1 = rand(1555,999999999);



$foto = "$foto$rand";



$foto = md5($foto);



$foto = "$foto$ext";



	if(move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$foto)){

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

		

		

 include '../concha.php';

 $ID_nota = $_GET['ID_nota'];



$sSQL = "INSERT INTO  `planetacabezon4`.`fotos_notas_hd` (`ID`,`foto`,`noticia`,`carpetafoto`) VALUES (NULL ,'$foto','$ID_nota','uploads');";
$conn->query($sSQL);



		exit;

	}

}



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

exit;