<?php
header("Access-Control-Allow-Origin: * ");
header("Content-Type:application/json; charset=UTF-8");
header("Access-Control-Allow-Methods:POST");
header("Access-Control-Max-Age:3600");
header("Access-Control-Allow-Headers:Content-Type,Access-Control-Allow-Headers,Authorization,X-Requested-With");
/*
if($_SERVER['REQUEST_METHOD'] !== 'POST'){
	echo json_encode(array('status' => false));
	exit;
}*/
$path="comprobante/";
if(isset($_FILES['file'])){
	$originalname=$_FILES['file']['name'];
	$filePath = $path.$originalname;
	if (!is_writable($path)) {
		echo json_encode(array('status'=>false,'msg'=>'El directorio no existe, o no tiene permisos de acceso'));
	}
	if(move_uploaded_file($_FILES['file']['tmp_name'], $filePath)){
		echo json_encode(array('status'=>true,'ruta'=>$filePath));
	}
}else{
	echo json_encode(array('status'=> false,'msg'=>'No se ha cargado el archivo'));
}
?>